React-native-web: Breaking React 17 changes

Created on 13 Jul 2018  ·  4Comments  ·  Source: necolas/react-native-web

Is your feature request related to a problem? Please describe.
A lot of lifecycle + server side rendering changes are occurring in React 16. It would be nice to have a branch of RNW that builds towards those changes (and is a breaking version change that supports react: ^0.16)

Describe alternatives you've considered
It is hard to do stuff like render = React.version.minor >= 16 ? ReactDom.hydrate : ReactDom.render

Additional context
A sep branch would be nice because the changes of all component lifecycles to the new approach I'm sure will take time, and need to trace changes to the master branch

[Edit]
I realized that you swap hydrate for render based on process.env.NODE_ENV. Maybe for the time being would you consider allowing to pass in a renderFn so users can default to hydrate?

Related Warning:
screenshot 2018-07-13 05 20 18

Most helpful comment

@necolas are your intentions to address these deprecations within #1172 or somewhere else? Are you interested in me opening a PR adding the UNSAFE_ prefix to suppress the current warnings from using RNW with React >=16.9.0?

All 4 comments

Link to the changes?

https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html

One of the biggest lessons we’ve learned is that some of our legacy component lifecycles tend to encourage unsafe coding practices. They are:

  • componentWillMount
  • componentWillReceiveProps
  • componentWillUpdate

16.3: Introduce aliases for the unsafe lifecycles, UNSAFE_componentWillMount, UNSAFE_componentWillReceiveProps, and UNSAFE_componentWillUpdate. (Both the old lifecycle names and the new aliases will work in this release.)

A future 16.x release: Enable deprecation warning for componentWillMount, componentWillReceiveProps, and componentWillUpdate. (Both the old lifecycle names and the new aliases will work in this release, but the old names will log a DEV-mode warning.)

17.0: Remove componentWillMount, componentWillReceiveProps, and componentWillUpdate . (Only the new “UNSAFE_” lifecycle names will work from this point forward.)

Oh I thought it was something new. I'm aware of this, thanks. I don't think a branch is necessary

@necolas are your intentions to address these deprecations within #1172 or somewhere else? Are you interested in me opening a PR adding the UNSAFE_ prefix to suppress the current warnings from using RNW with React >=16.9.0?

Was this page helpful?
0 / 5 - 0 ratings