-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Add back React.__spread and make it warn #6444
Conversation
Can we make it say something about TypeScript and JSTransformer specifically so people know how to upgrade? |
warning( | ||
warned, | ||
'React.__spread is deprecated and should not be used. Use ' + | ||
'Object.assign directly or another helper function with similar semantics' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add trailing period
Coffee-React uses it as well fwiw https://github.com/jsdf/coffee-react#spread-attributes |
'Object.assign directly or another helper function with similar semantics' | ||
); | ||
warned = true; | ||
return Object.assign.apply(Object, arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to make this Object.assign.apply(null, arguments)
(shouldn't matter but makes more sense when compiling to use object-assign. `_assign.apply(null, arguments)
At least these days we know how to name things. |
@@ -65,6 +81,9 @@ var React = { | |||
DOM: ReactDOMFactories, | |||
|
|||
version: ReactVersion, | |||
|
|||
// Hook for JSX spread, don't use this for anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe state in the comment that this is deprecated and evil to use?
I originally confused this with https://github.com/facebook/react-native/blob/master/Libraries/ReactNative/ReactNative.js#L96 and got overexcited to kill this too. I should've deprecated it first. |
efc4042
to
7072559
Compare
Better? I figured we could just link to a page on the wiki that discusses typescriupt and coffeescript specifically instead of putting it in the warning. |
👍 |
@zpao updated the pull request. |
Just going to point that fb.me url here for the time being. We can change it later, but I'm optimizing for the path which gets me to a drink fastest. |
@zpao updated the pull request. |
Add back React.__spread and make it warn (cherry picked from commit 516c1d8)
Seeing a few people pop up in support channels with this issue - might be worth adding a note to the v15 announcement? Medium-term: I wonder if there's a good way to automatically check compatibility with widely used downstream projects against RCs. I know really that should be downstream's responsibility - but I wonder if there's anything React's team/community can do to help. |
This bit me on the bum when I just upgraded to 15.0. I get that it's been deprecated/removed but even after reading this thread I'm a confused on what I need to do fix it? Edit: I think I need to point out that I'm not using return (
<input type="text" value={value} onChange={onChange} className={classeNames} {...other} />
); and the React.spread(..) Does this make a difference? |
This is not a problem with your code. It's a problem with whatever tool you use to compile JSX. If you are using The fix will be out today because TypeScript still depends on it but this method is still deprecated so please try to migrate to tools that don't use it. |
@gaearon Thanks Dan, thats what I thought. Forgive me but how do I switch from using react-tools to babel? I already tried this morning after reading through the blog post but didn't really know what I was doing..? |
How do you compile JSX? |
webpack loaders.. module.exports = {
entry: './js/app.js',
output: {
filename: './bundle.js',
path: './static/'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'jsx?harmony'
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url?limit=8192'
},
{
test: /\.css$/,
loader: 'style!css'
}
]
}
}; |
You are using |
Ahh I see, great than you Dan. On 8 April 2016 at 16:01, Dan Abramov notifications@github.com wrote:
|
I'm doing these things now and still getting the depreciation warning. Is this to be expected until Typescript fixes whatever internals they need to fix? Or should I investigate further? |
If you use TypeScript, yes, you will need for them to release the fix. |
Ok great that's what I assumed. Thanks for the clarification 👍 |
As a heads up, this should now be fixed in TypeScript 1.8.10. |
Thanks @DanielRosenwasser, I appreciate the quick turn around! Sorry for the surprise breakage. |
No worries - I've been trying to keep a better eye on the activity of the repo since this all first went down. We really appreciate how quick the React team was to get a fix out! |
This API was removed because it was undocumented and existed solely for our JSXTransformer/react-tools, which haven't been supported for a year. However it turns out TypeScript is still using this API in their TSX compilation and it kind of sucks to break people who want to upgrade React but not the rest of their toolchain.
Note: this doesn't quite (read at all) work with theObject.assign
->object-assign
transform I wrote so would need to fix that too.