Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is "Dynamic" variations of createElement needed? #141

Open
safareli opened this issue Apr 13, 2018 · 5 comments
Open

is "Dynamic" variations of createElement needed? #141

safareli opened this issue Apr 13, 2018 · 5 comments

Comments

@safareli
Copy link
Contributor

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

@safareli
Copy link
Contributor Author

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.

@paulyoung
Copy link
Contributor

I'm not familiar with React 16 yet but I think it's still necessary for React 15.

@safareli
Copy link
Contributor Author

@ethul
Copy link
Contributor

ethul commented Apr 13, 2018 via email

@natefaubion
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants