Closed gaearon closed 6 years ago
@gaearon sure, though in my defence I'm asking for fewer features 😎
State is first-class citizen in React, see https://github.com/facebook/react/issues/3398#issuecomment-98850930 for some thoughts about it.
@gaearon should we add removing isMounted
and replaceState
from class components to the 16 roadmap? They are currently deprecated.
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).
@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
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.
@cvle Do you want to join forces with @taion and @jquense on https://github.com/reactjs/react-transition-group?
@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.
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
?
@gaearon can this issue also be part of 15.5? https://github.com/facebook/react/issues/7211
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.
@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.
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?
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.
@koba04 @probablyup We have plans to rethink context but it won't happen in the near future.
@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
};
Posted a plan for addons: https://github.com/facebook/react/issues/9207
15.5.0-rc.1 prints a warning about ReactCSSTransitionGroupChild
using React.createClass
. Maybe reconsider #7701 for 15.5+?
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.
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.
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.
It would probably make more sense to show individual warnings for the deprecated addons if people use them.
Looks like there's a serious bug in 15.5 RC: https://github.com/facebook/react/issues/9351
Shouldn't prop-types
15.5.0 come with an UMD build?
It should. Also I think it makes sense to move doc to its README. cc @acdlite @flarnie
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 ".
Yea I don't understand it either yet 😛 we'll clear it up with the release.
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.
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
The React team recently took over the prop-types package.
What's the plan for where the source of truth will be?
did ya'll still want react-prop-types
or do I not need to worry about transferring that anymore?
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.
@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.
@acdlite Where will source code for prop-types
live? Who will manage the repository?
@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?
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.)
reactjs/prop-types
?
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.
Sounds good to me
👍 for reactjs/prop-types
Is there any update on the optimizations for stateless
functional component since now v16/fiber is right at the corner?
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
@gaearon doesn't prop-types error out if you try to use it outside of a React context?
@probablyup No if you use the supported API for checking it (PropTypes.checkPropTypes
).
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.
@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! :)
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.
Please file an issue in this repo. The module itself is in the 15-stable branch (since we don't plan further development).
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
.
React v16 is not release until now, why?
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)
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
still exists after RC2turns out to be polyfill.io bug, https://github.com/Financial-Times/polyfill-service/issues/1299) https://www.reddit.com/r/javascript/comments/6pqrz5/comment/dmrl0nhunstable_
prefix fromunstable_createPortal
and alias it @gaearon https://github.com/facebook/react/pull/10675render
createPortal()
/umd/*
rather thansebmt/*
)TODO: Add any bugs discovered while testing RC.
16 Wishlist
unstable_forceUpdateDeep()
and then change https://github.com/gaearon/react-deep-force-update to use it)setState
updater form (https://twitter.com/nishb1/status/852542873803345920) (@gaearon will follow up)Past Releases
`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/9351reviewupdated 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.