There's a new render prop/children-as-function API for context that just came in React 16.3.0.
The big thing that's relevant to us: It works across shouldComponentUpdate
boundaries without the need for subscriptions.
It will require some refactoring. And backward compatibility is going to be...interesting. We may have to drop backward compatibility to make the implementation clean. FWIW, React Router and React Redux is considering this too, so we're not alone.
Regarding backward compatibility: https://github.com/jamiebuilds/create-react-context
@leMaik I'm not sure that using create-react-context will be a wise call to make.
I start to believe the best approach would be to rely on the old context API up until React 17.0.0 land and introduce a breaking change to move to the new API. Let's wait and see what the community is doing. I don't think that we need to be bleeding edge on this topic.
I would prefer dropping support for React < 16.3 in 1.0.0. People will hate us, but they'll need to effectively rewrite their app anyway when they update. Also, React 16.x is _very_ stable, API-wise, so upgrading from React 16.0 to 16.3 to 16.x should be easy.
Regarding the metrics of the package: Didn't look at that, missing issues and 1.4 kB overhead are a pretty big no-go.
I would prefer dropping support for React < 16.3 in 1.0.0.
@leMaik We will at least drop React < 16.0 support between 1.0.0-beta.x and 1.0.0.
It's a matter of timing. If the react team release React 17.0 in one year from now, I think that we can wait Material-UI 2.0.0 otherwise, as you say.
@oliviertassinari Any updates on that? Are there any plans on dropping support of React < 16.3 for 1.0.0. Just considering moving to new context api for material-ui-pickers. But don't want to force the community migrate to React 16.3 till material-ui not.
@dmtrKovalenko We will drop support for React 15.x in Material-UI v1. There is no plan for dropping React 16.0. I think that we will wait for Material-UI v2.
Be careful. React 16.4 will start warn about deprecated api. Waiting react 17 is a case only for application. All third party libraries has only 16.3 - 16.4 migration period.
create react context is used across many libs before dropping react < 16.3 support. PRs are open, so all possible problems are fixable.
@TrySound I believe that we have fixed all the deprecation warnings introduced in React 16.3. Unless the React team plans on adding new ones, we should be good on waiting React 17. If they do, we will release Material-UI v2 sooner than expected and drop < React 16.3 support. I wish we can wait +6 months between v1 and v2. We plan on releasing Material-UI v1 May 17th. The timing is short.
Hi @oliviertassinari I am using React 16.3 and MUI next beta.44 in a project and I seed the following warnings coming from ButtonBase
and Modal
.
@willopez Make sure you use the most up to date version of react-hot-loader.
@oliviertassinari I'm not sure how #11361 helps. Whenever you get rid of the polyfill and use the new API, won't you have to release it as a breaking change anyway? Because if people have version 1.0.0
, which doesn't use the new API, and the upgrade to a semver-compatible version that does use the API (1.something
) without upgrading React, it will break their app, and the only warnings they will get are are peer dependency mismatches.
Nevermind, I didn't notice the dates on this thread, I see that React 16.3.0 is required as of version 1.0.0
. Very good!
@eps1lon We are pretty much done with this task no? I think that we can close.
core/styles/withStyles
is still open. As far as I understood it this will require cssinjs/jss#924?
@eps1lon People can already use @material-ui/styles
today. It's using DI to completely replace the usage of core/styles/withStyles
.
That's still alpha though. I guess it's ok since we want to migrate mui/styles
anyway I suppose. We can close then.
@oliviertassinari I'm confused, do you consider the new React context API a form of dependency injection? Or is there a branch of material-ui/styles that uses something different?
@jedwards1211 @material-ui/styles
uses the new context API, that's all.
Cool, i was nervous when I saw "DI" :rofl:
Most helpful comment
I would prefer dropping support for React < 16.3 in 1.0.0. People will hate us, but they'll need to effectively rewrite their app anyway when they update. Also, React 16.x is _very_ stable, API-wise, so upgrading from React 16.0 to 16.3 to 16.x should be easy.
Regarding the metrics of the package: Didn't look at that, missing issues and 1.4 kB overhead are a pretty big no-go.