1 |
|
2 |
|
3 | var React = require('react')
|
4 | var formatChildren = require('./base-format-children')
|
5 |
|
6 | function 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 |
|
13 | exports.formatChildren = formatChildren.bind(null, applyChildren)
|