UNPKG

454 BJavaScriptView Raw
1'use strict'
2
3var React = require('react')
4var formatChildren = require('./base-format-children')
5
6function applyChildren (element, children) {
7 if (process.env.NODE_ENV !== 'production' && !React.isValidElement(element)) {
8 throw new Error(JSON.stringify(element) + ' is not a valid element')
9 }
10 return React.cloneElement.apply(React, [ element, null ].concat(children || []))
11}
12
13exports.formatChildren = formatChildren.bind(null, applyChildren)