kay-is / react-from-zero

A simple (99% ES2015 less) tutorial for React
https://www.fullstackreact.com/react-from-zero/
GNU General Public License v2.0
4.6k stars 405 forks source link

Update to React 16 #9

Closed kay-is closed 6 years ago

kay-is commented 6 years ago

Saw that this repository somehow ended up as one of the most popular courses on Github (based on stars, lol)

Anyway, the current version of React is 16.3.1 and this course is based on 15.4.2 Some things have changed and need to be adressed. (PropTypes, context, lifecycle methods, etc. pp.)

Also, maybe this course could use some updates in general.

So what steps need to be taken?

  1. Someone needs to check what changed since 15.4.2
  2. Someone needs to write PRs to adress these changes

I'm using a rather old version of Babel to enable in-browser compilation of JSX, we probably need to check if this will still work with the new React version.

If someone is interested in this, just go for it.

kay-is commented 6 years ago

Also some advanced lessons for higher order components and render props/function as children would be nice.

kay-is commented 6 years ago

Seemingly babel-core isn't the way to go anymore, babel-standalone is and it's also integrated into the main Babel repo.

https://new.babeljs.io/docs/en/next/babel-standalone.html

kay-is commented 6 years ago

With version 16 React.PropTypes and React.createClass are gone. These now require some extra packages.

Also, if you create element objects manually, you need to set ref explicitly to null or React 16 will complain.