React: React spread operator is still in the official documentation

Created on 20 Oct 2017  路  4Comments  路  Source: facebook/react

Bug in documentation

What is the current behavior?
React's spread operator was removed in React 16, but it is still in the documentation https://reactjs.org/docs/jsx-in-depth.html#spread-attributes

What is the expected behavior?
A word of caution should be included that this does not include React 16+. Maybe also add other ways of spreading props.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16+. It worked in previous releases.

Question

Most helpful comment

I figured out what is happening. My code used JSXTransformer, which compiled the spread attribute to React.__spread. Thanks for helping me figure it out.

All 4 comments

Spread operator is a language feature, it was not (and could not) be removed in React 16.

What are your referring to?

@salehhamadeh you may be thinking of React.__spread which was removed in https://github.com/facebook/react/pull/8942. As @gaearon pointed out, the spread operator is an entirely different thing. I hope that clears things up.

I figured out what is happening. My code used JSXTransformer, which compiled the spread attribute to React.__spread. Thanks for helping me figure it out.

Oh I see. Yeah, JSXTransformer might have broken since then. But also note that it has been unsupported for about two years now. And you should not be using it in production (if you did)鈥攊nstead, please compile JSX with Babel ahead of time.

Was this page helpful?
0 / 5 - 0 ratings