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

Replace React.__spread with Object.assign #71

Merged
merged 1 commit into from
Apr 13, 2016

Conversation

DawidJanczak
Copy link
Contributor

Addresses #70 React 0.15.1 works, but throws warnings when using __spread.

@jsdf you mentioned still supporting __spread, but it will be removed from React soon. Can we not just replace it with Object.assign?

@max-degterev
Copy link

Probably needs a warning that Object.assign polyfill is required

@DawidJanczak
Copy link
Contributor Author

I'm a bit new to Node/npm so forgive me if I'm misunderstanding this, but React already includes that polyfill as its dependency. In fact even if we stick to React.__spread here it will eventually get resolved to Object.assign anyway https://github.com/facebook/react/blob/master/src/isomorphic/React.js#L36

@jsdf
Copy link
Owner

jsdf commented Apr 13, 2016

I don't think react's Object.assign polyfill will help here, as looking at the compiled react library, it looks like they are transforming their code to replace calls to Object.assign with calls to a Object.assign 'ponyfill', which doesn't touch the global Object. This means that people using coffee-react generated code which contains spreads will need to provide their own polyfill. I'll update the readme before cutting the next release.

@jsdf jsdf merged commit b414d92 into jsdf:master Apr 13, 2016
@DawidJanczak DawidJanczak deleted the remove-react-spread branch April 13, 2016 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants