facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
227.75k stars 46.48k forks source link

React 16 Umbrella ☂️ (and 15.5) #8854

Closed gaearon closed 6 years ago

gaearon commented 7 years ago

This list might change, just putting it out there as the first draft. Posting these together since they're related, and we don't plan more 15.x releases after 15.5 anyway.

To put these changes in context, we have a few goals:

(Click to show)

* For the past several months, we have been working on a [rewrite of React codenamed “Fiber”](https://www.youtube.com/watch?v=aV1271hd9ew&feature=youtu.be). Initially, it won’t affect public API, but it brings several new features (like https://github.com/facebook/react/issues/2127 and https://github.com/facebook/react/issues/2461). Fiber gives us a solid foundation to improve React core in numerous ways. We’ll be talking more about it soon, and we intend to ship it with React 16 by default. * To reduce the bundle size, we need to remove the APIs that we don't recommend, such as `createClass` and `React.DOM.*` helpers. We intend to warn once about their usage so that you can start removing dependencies on them. They will still be available as separate packages, but we will exclude them from the default build of React 16. * We would like to have more control over the bundles so that we can better optimize them. This is why we are considering switching to flat bundles (and thus removing access to React internals in `react/lib/*` and `react-dom/lib/*`) in React 16. This will also mean faster compile times by default for users of Webpack and other bundlers, and faster server-side rendering performance.

Here’s a speculative list of changes we think of doing in these releases:

Past Releases

I’ve moved these to the end of this post.

16 Final

TODO: Add any bugs discovered while testing RC.

16 Wishlist


Past Releases

# 15.5 (Click to show)
- [x] ReactDOM fixes, if @jquense @nhunzaker @aweary want to release any. - [x] We should probably ship a fix for https://github.com/facebook/react/issues/8487 (https://github.com/facebook/react/pull/9005) - [x] New warning: callback refs on stateless functional components (https://github.com/facebook/react/pull/8635, https://github.com/facebook/react/pull/8739) - [x] New API deprecations: - [x] `React.createClass` (will be moved to a separate package, [and we provide a codemod](https://github.com/reactjs/react-codemod#explanation-of-the-new-es2015-class-transform-with-property-initializers) if you want to update to ES classes) - [ ] ~~`React.createFactory` (will be moved to a separate package or removed, it's a [one-liner](https://github.com/facebook/react/blob/eb89bc4c301c5970b1ec88d3fdfa2202d4dca4f8/src/isomorphic/classic/element/ReactElement.js#L271-L272))~~ - [ ] `React.DOM.*` factories (will be moved to a separate package, https://github.com/facebook/react/pull/8356) **We forgot to do it. Moving to 15.6** - [ ] `React.createMixin` (will be removed, https://github.com/facebook/react/pull/8853) **We forgot to do it. Moving to 15.6** - [x] `React.propTypes` (will be moved to a separate package) - [x] Deprecate React addons https://github.com/facebook/react/issues/9207 - [x] Decide how to handle all of this with the UMD addons build - [x] Fix this bug https://github.com/facebook/react/issues/9351
# 15.6 See https://github.com/facebook/react/issues/9398. # 16 Alpha (Click to show)
- [x] Remove deprecations added in 15 - [x] Stop appending `px` to strings (https://github.com/facebook/react/pull/6899) - [x] Remove `LinkedStateMixin`, `valueLink` and `checkedLink` (https://github.com/facebook/react/pull/8165) - [x] Remove `React.__spread` and `React.createMixin` - [x] Move `React.createClass` to a separate package - [x] Move `PropTypes` to a separate package. - [x] Move `React.DOM.*` factories to a separate package - [x] Decide what to do with the addons build - [x] If we keep any addons, they need to work regardless of whether React is aliased to a flat bundle or not (which is not the case now) - [x] Strip PropTypes checkers in production build (https://github.com/facebook/react/pull/8066) - [x] Re-add warning about calling PropTypes directly (https://github.com/facebook/react/issues/8080) - [X] More ReactDOM fixes, if @jquense @nhunzaker @aweary want to release any. - [x] Make a decision on the input fix by @jquense (for now accepted, but follow up work will change this. @flarnie link to issue on related follow up work)
# 16 Beta (Click to show)
- [x] Actually enable fragments (@flarnie verified this) - [x] Make error boundaries official (@bvaughn) - [x] Choose lifecycle naming - [x] Codemod stuff - [x] Decide whether to runtime warn for the old name (decided: let's not do it) - [x] Fix the issue with `invokeGuardedCallback` (tracking in https://github.com/facebook/react/issues/9577, @acdlite is working on this) - [x] (This came up internally) Set a hard limit for recursion https://github.com/facebook/react/issues/9193. (@acdlite) - [x] Duplicate React + string refs results in very confusing error (ref is not a function). We should provide a good invariant for that. (https://github.com/facebook/react/issues/9962, @spicyj @flarnie and @gaearon) (is this Draft issue also about this? https://github.com/facebook/draft-js/issues/296) - [x] Is there a test for this? (@flarnie) - [x] Warn (throw?) when doing an update on a container that was manually emptied outside of React (in stack, this mounted a brand-new tree; in fiber, it tries to apply an update and usually fails) (@flarnie in https://github.com/facebook/react/pull/10210) - [x] Is there a test for this? (@flarnie) - [x] Additional APIs we need in order to start experimenting with async. (@acdlite) - [x] `React.unstable_AsyncComponent` - [x] `ReactDOM.flushSync(batch)` - [x] sanity test - use in a CRA app, and check fixtures - [x] Messaging - [x] Update isfiberreadyyet.com - [x] Compose a Tweet
# 16 RC (Click to show)
- [x] [m-l] Pass DOM props through (https://github.com/facebook/react/issues/10399, latest is: https://github.com/facebook/react/pull/10416) (@gaearon, @spicyj, @sebmarkbage, @flarnie, @acdlite) - [x] Regression: we should warn if object is passed to an event listener prop #10407 (@aweary) (fixed? in https://github.com/facebook/react/pull/10453 but needs review updated and merged) - [x] Make sure input variables (props, state) point to the correct values for each lifecycle. Example where this isn't the case for `componentWillMount`: https://jsfiddle.net/m3pL3yaj/ (@acdlite) (fixed in #10481) - [x] `select`'s onChange event fires with incorrect selectedIndex, value (https://github.com/facebook/react/issues/10420 @sebmarkbage) - [x] How do we ensure weak minifiers don't ship the bundle twice? https://github.com/facebook/react/issues/9589 (@flarnie, @trueadm) (fixed in https://github.com/facebook/react/pull/10446) - [x] Bug: SSR has false positive warnings for SVG tags #10415 (@spicyj) (fixed in https://github.com/facebook/react/pull/10452) - [x] Bug: Unexpected cross-domain error passed to `componentDidCatch` #10441 (@bvaughn) (fixed in https://github.com/facebook/react/pull/10447) - [x] Warn when nesting a 15 tree inside 16 (@spicyj https://github.com/facebook/react/pull/10434) (fixed in https://github.com/facebook/react/pull/10434) - [x] undefined is not a function (evaluating 'owner.getName()') https://github.com/facebook/react/issues/10443 - [x] Regressions reported in beta - [x] The server renderer crashes in production with inline styles. (https://github.com/facebook/react/issues/10299, fixed by https://github.com/facebook/react/pull/10300) - [x] The server renderer doesn't yet support returning arrays and strings from components (fixed by #10221) - [x] The server renderer still renders `data-reactid` somewhat unnecessarily. (https://github.com/facebook/react/issues/10306) (@gaearon) - [x] Potentially fixed by https://github.com/facebook/react/pull/10339 (@gaearon) - [x] In some cases `Error: null` is reported instead of the real error. (https://github.com/facebook/react/issues/10321) [decision: update the error message] (@acdlite) - [x] Shallow renderer doesn't implement `unstable_batchedUpdates`. [decision: team seems to be leaning away from doing this; discussion in #10355] - [x] [s-m] `shouldComponentUpdate` with functional components [decision: delete it for now, add it in a minor] (@sebmarkbage) https://github.com/facebook/react/pull/10371 - [x] There is a report that Google crawler can’t render the page using 16 ([link](https://www.reddit.com/r/javascript/comments/6pqrz5/react_16_beta/dkrgvzj/?utm_content=permalink&utm_medium=front&utm_source=reddit&utm_name=javascript)). (@flarnie) - [x] Check if https://github.com/facebook/react/issues/10405 is a real regression (No, it's been fixed looks like.) - [x] [s-m] Ensure type validation didn't regress when we enabled new features https://github.com/facebook/react/issues/9577 (@gaearon) - [x] Decide if we want to break value attribute syncing behavior (https://github.com/facebook/react/pull/10150) [decided to postpone until 17] - [x] [s-m] Decide if we want to stop calling `componentDidUpdate` from shallow renderer (https://github.com/facebook/react/pull/10372) - [x] Decide: what do we do about polyfills? - [x] Map/Set (need to throw early, @gaearon) https://github.com/facebook/react/pull/10356 - [x] Object.assign (keep or assume it's there?) https://github.com/facebook/react/pull/10280 [decision: keep it bundled for now] - [x] rAF [decision: keep it required] (Maybe use the same approach/standard as Relay? https://facebook.github.io/relay/docs/relay-modern.html#javascript-environment-requirements) - [x] Big missing pieces - [x] Add server rendering and reviving - [x] Add shallow renderer - [x] We seem to be decoupling shallow renderer from ReactDOM. However in 15 `findDOMNode()` works inside of shallow renderer because it contains ReactDOM injections. Is this going to be a breaking change? (@gaearon) [decision: let's not support this] - [x] Decide on whether to include warning whitelisting/blacklisting (@bvaughn) [decision: not in 16.0] - [x] Maybe: Switch to flat bundles (no more `react-dom/lib/*`, internals are truly private) - [x] Decide: plan forward for popular projects depending on internals (`react-native-web`, `react-tap-event-plugin`) (might not block final) - [x] `EventPluginHub` is "dangerously" exported from flat bundle for tap event plugin - [x] `react-native-web` probably needs more internals, coordinate with @necolas (done in https://github.com/facebook/react/pull/10138) - [x] Support `class` and `for` https://github.com/facebook/react/pull/10169 (@gaearon) [decision: not gonna do this now] - [x] Feature parity for renderers - [x] Shallow renderer supports strings and arrays - [x] Server renderer supports strings and arrays - [x] Server renderer supports error boundaries [doesn't make sense conceptually right now] - [x] Decide on whether to put `react-current-owner` in its own package to reduce issues caused by npm duplication [not now] - [x] Decide on DOMServer entry points (`react-dom/server` and `react-dom/node-stream` seem inconsistent with each other. Why is only one of them `server`?) (@gaearon) https://github.com/facebook/react/pull/10362 * These were configured separately for Prepack. One target includes both the pure JS APIs and the Node APIs and the other only includes the pure JS APIs. We could combine them into a single `react-dom/server` entry point and add a new `renderToString` method on it. - [x] Decide: Do we care about catching errors in events in the initial release? [no] - [x] Error messages (@flarnie) (Dan: I moved this back to blockers because I don't think we can release with unclear messages. Error boundaries are a huge change in open source and we must have documentation and a link before we start unmounting roots.) - [x] "You can add an error boundary" message should link to docs - [x] duplicate key warning for children with same keys is out of date; claims child will be ignored but now we will only render second one. (easy to add to 16 final or sooner) (@sebmarkbage) - [x] Verify that the bundles produced are valid in strict mode. https://github.com/facebook/react/issues/10294#issuecomment-319490960 (@bvaughn) - [x] Testing the Beta: (React team in general) - [x] Share the beta and proposed release date with library authors several weeks in advance - [x] Triage any issues reported with beta.
danielearwicker commented 7 years ago

@gaearon sure, though in my defence I'm asking for fewer features 😎

gaearon commented 7 years ago

State is first-class citizen in React, see https://github.com/facebook/react/issues/3398#issuecomment-98850930 for some thoughts about it.

aweary commented 7 years ago

@gaearon should we add removing isMounted and replaceState from class components to the 16 roadmap? They are currently deprecated.

quantizor commented 7 years ago

Why is removing isMounted() a thing? It's useful for async callbacks. It's a very simple function, barely adds any size to the library, and implementing similar functionality as the user means opting into 2 separate callbacks lifecycle methods (cDM and cWU).

aweary commented 7 years ago

@yaycmyk see https://github.com/facebook/react/issues/5465 which links to a number of issues providing background on why it was deprecated.

edit: I see that you already know about that issue 😄 I'll defer back to the points made there

cvle commented 7 years ago

I see the ReactCSSTransitionGroup addon will soon be deprecated. I've been working on a similar project for some time now and it needs some exposure. Check it out here: react-css-transition.

gaearon commented 7 years ago

@cvle Do you want to join forces with @taion and @jquense on https://github.com/reactjs/react-transition-group?

cvle commented 7 years ago

@gaearon I'm open for collaboration. Though both projects are quiet different at the moment and I have no idea in which way the project https://github.com/reactjs/react-transition-group is heading, while https://github.com/wikiwi/react-css-transition is almost feature complete (though it needs some testing on the battlefield).

You know what, I'm gonna open an issue over at https://github.com/reactjs/react-transition-group to discuss this.

koba04 commented 7 years ago

I have a question. React deprecates React.createClass in v15.5 and removes it in v16. Is a separate package for React.createClass (react-create-class?) released at the time of v15.5? Is the separate package in facebook/react repo or in reactjs organization like react-transition-group?

salmankhann commented 7 years ago

@gaearon can this issue also be part of 15.5? https://github.com/facebook/react/issues/7211

SanthoshHari912 commented 7 years ago

Any plan to revive the licensing of React library ? Right now the Patents added along with the BSD licensing has become a debatable topic, and many enterprises back foot on using React for the same reason.

gaearon commented 7 years ago

@salmankhann We’re not sure. See https://github.com/facebook/react/pull/8575#issuecomment-284192820 for latest thinking on this.

@SanthoshHari912 I don’t know if you’ve seen other threads about this, but I believe everything we have to say about this is already there, including who to reach out to if you still want to argue about this. I would appreciate if technical threads were not derailed with this because it is very demotivating. Thanks.

koba04 commented 7 years ago

I just noticed that Move PropTypes to a separate package. was added to this list. What about PropTypes used in Context as contextTypes and childContextTypes? Are there any plans for changing Context API?

quantizor commented 7 years ago

I'm curious if propType checking is really necessary for context. It seems like merely opting in to a key would be sufficient and simplify the API.

acdlite commented 7 years ago

@koba04 @probablyup We have plans to rethink context but it won't happen in the near future.

koba04 commented 7 years ago

@acdlite Thanks! I got it.

In v16, Do we use PropTypes and Context like this? (We need to install the separated package for PropTypes when using Context)

import React from 'react';
import PropTypes from 'react-prop-types'; // or something

const Box = ({text}, {theme}) => <div className={theme}>{text}</div>;
Box.propTypes = {
  text: PropTypes.string
};
Box.contextTypes = {
  theme: PropTypes.string
};
gaearon commented 7 years ago

Posted a plan for addons: https://github.com/facebook/react/issues/9207

jochenberger commented 7 years ago

15.5.0-rc.1 prints a warning about ReactCSSTransitionGroupChild using React.createClass. Maybe reconsider #7701 for 15.5+?

jochenberger commented 7 years ago

And also one about React.PropTypes being used. Unfortunately, there is no location information printed along with the warning, but I was able to trace it down to ReactTransitionGroup. I guess these warnings appear because I use the react-with-addons UMD package. If the addons package is also deprecated, maybe there should be a warning when the file is loaded.

jochenberger commented 7 years ago

Or maybe the best solution would be to somehow suppress those warnings from within the addons build. If you need to use the addons build (e.g. because you want to use React.Perf), there's not really an alternative in 15.5.

gaearon commented 7 years ago

Good point, it's indeed confusing that we warn in our own build. I agree we should suppress these warnings for our own uses of them.

The addons build will be deprecated because each individual addon is either deprecated or unmaintained. TestUtils is moving to ReactDOM, and ReactPerf will not be available in 16 (instead you can use component profiling in browser DevTools Timeline). For other addons, if you want to keep using them, you need to switch to their npm packages (they now include browser builds too). But I'm not sure if it makes sense to have an additional warning about the build itself or not.

jochenberger commented 7 years ago

It would probably make more sense to show individual warnings for the deprecated addons if people use them.

gaearon commented 7 years ago

Looks like there's a serious bug in 15.5 RC: https://github.com/facebook/react/issues/9351

jochenberger commented 7 years ago

Shouldn't prop-types 15.5.0 come with an UMD build?

gaearon commented 7 years ago

It should. Also I think it makes sense to move doc to its README. cc @acdlite @flarnie

jochenberger commented 7 years ago

The prop-types topic is confusing (at least to me). The docs link to https://github.com/aackerman/PropTypes, but that doesn't have any tags and the last commit was over a year ago. https://www.npmjs.com/package/prop-types however links to https://github.com/facebook/react and shows, that "15.5.0 is the latest of 4 releases ".

gaearon commented 7 years ago

Yea I don't understand it either yet 😛 we'll clear it up with the release.

bvaughn commented 7 years ago

FYI the serious bug in RC1 (#9351) was resolved with an RC2 release yesterday evening.

The docs link to https://github.com/aackerman/PropTypes, but that doesn't have any tags and the last commit was over a year ago.

@jochenberger: Sorry if I'm overlooking something, but which docs link to this project?

https://www.npmjs.com/package/prop-types however links to https://github.com/facebook/react and shows, that "15.5.0 is the latest of 4 releases ".

The React team recently took over the prop-types package. This is what we'll be using going forward. If we have any links in our docs that point to the other one, I'll be happy to correct them.

gaearon commented 7 years ago

If we have any links in our docs that point to the other one, I'll be happy to correct them.

I think this line was related to this from #9359:

https://github.com/facebook/react/pull/9359/files#diff-cfcea6c43d62e54e6c86684cd87e2f5dR8

gaearon commented 7 years ago

The React team recently took over the prop-types package.

What's the plan for where the source of truth will be?

jquense commented 7 years ago

did ya'll still want react-prop-types or do I not need to worry about transferring that anymore?

gaearon commented 7 years ago

We ended up on prop-types I guess. Since it's not very React specific and could potentially be used by Preact, Inferno, and something else.

acdlite commented 7 years ago

@jquense We're using prop-types as the source of truth.

One scenario I'm worried about is folks installing react-prop-types without realizing it's not the official package. For example, in addition to create-react-class we also own react-create-class so we can point users to the correct package.

gaearon commented 7 years ago

@acdlite Where will source code for prop-types live? Who will manage the repository?

acdlite commented 7 years ago

@gaearon Right now it's just in our 15.5-dev branch. Haven't decided where it should live. I'm cool with either leaving it in the React repo for now, or moving it to its own repo. Any preference?

acdlite commented 7 years ago

And I think we should continue to maintain it, since PropTypes remain popular and there's no great alternative yet. (There's Flow and TypeScript, but I think we agree that's not a viable option for every team.)

gaearon commented 7 years ago

reactjs/prop-types?

gaearon commented 7 years ago

The reason I'd like to move it out is to stop flooding React issue tracker with PropTypes feature requests. They get lost here and don't get the necessary discussion.

acdlite commented 7 years ago

Sounds good to me

bvaughn commented 7 years ago

👍 for reactjs/prop-types

coodoo commented 7 years ago

Is there any update on the optimizations for stateless functional component since now v16/fiber is right at the corner?

necolas commented 7 years ago

On the topic of react-dom/lib/* modules…I wrote up some notes about the problems with migrating to flat React and using ResponderEventPlugin on web.

the Responder modules…have non-trivial dependencies on other React internals that aren't exposed in the public release of react-dom.

More: https://github.com/necolas/react-native-web/issues/364#issuecomment-294243735

quantizor commented 7 years ago

@gaearon doesn't prop-types error out if you try to use it outside of a React context?

gaearon commented 7 years ago

@probablyup No if you use the supported API for checking it (PropTypes.checkPropTypes).

gaearon commented 7 years ago

Is there any update on the optimizations for stateless functional component since now v16/fiber is right at the corner?

They take a separate path in Fiber so should have slightly less overhead. Nothing dramatic though.

LucaColonnello commented 7 years ago

@gaearon can I suggest something about this one Make a decision on shouldComponentUpdate with functional components?

Recently I did an experiment on writing virtual dom without libraries in 300 lines, starting from an already done implementation.

https://jsfiddle.net/Luca_Colonnello/5xebu97u/3/

So in this lite version, I used shouldComponentUpdate attached to nodes, wherever they are and it turned out I was able to override it from the parent of a component. I found it pretty useful and easy.

const shouldCommentsListUpdate = (props, nextProps) => {
   return props.comments !== nextProps.comments;
};

const List = ({ items }) => (
<div className='list'>
   {items.map((item) => (<div className='listItem'>{item}</div>))}
</div>
);

const Comments = ({ comments }) => (
<div className='commentsSection'>
   <List items={comments} shouldUpdate={shouldCommentsListUpdate} />
</div>
);

This gives us the ability to overwrite the inner implementation based on parent rules as well as apply the shouldUpdate function to other nodes which are not components.

Let me know what do you think about this solution! :)

jochenberger commented 7 years ago

Is there a repository for create-react-class? The UMD module does not work (React is undefined in line 764) and I'd like to report an issue, but I'm not sure where I'm supposed to do that.

gaearon commented 7 years ago

Please file an issue in this repo. The module itself is in the 15-stable branch (since we don't plan further development).

bvaughn commented 7 years ago

Im trying to get my hands dirty but I can't find any information if Fiber is the default renderer for @next or if there is a flag or something.

Fiber is the only renderer actually exported in react-dom@next.

blling commented 7 years ago

React v16 is not release until now, why?