is "Dynamic" variations of createElement needed?
safareli opened this issue · 5 comments
If you look at current master of React, in createElement there is no difference between spreading children or passing children as array:
https://github.com/facebook/react/blob/master/packages/react/src/ReactElement.js#L203-L219
I guess is this spread vs non spread version of createElement not needed any more
it was introduced as of #53
based on the current implementation of createElement in react, definition of createElement we have result's in more allocation then createElementDynamic, as it needs to copy children from arguments to array. and there is no point in doing this extra work as we already have children array at hand when calling both createElementDynamic and createElement.
I'm not familiar with React 16 yet but I think it's still necessary for React 15.
looks like it's same in v15 branch https://github.com/facebook/react/blob/15-stable/src/isomorphic/classic/element/ReactElement.js#L213-L229
I am wondering if on React 16, if you pass an array of elements to createElementDynamic without the elements having a key prop, does React still issue a warning?
AFAIK this is the only difference. When React sees an Array as child, it expects all the elements to have keys.