Episode 159 - React 16.3

preview_player
Показать описание

Context API!
No more props drilling! (Passing props through various components) Thanks to createContext function on the React class.

Yes, it is a new Context API, but if you use the old Context API, all will be good until React 17

StrictMode
Orders you to follow best practices, it basically will give you some warnings in the console.
Wrap your components in StrictMode tag and you are ready to go.

AsyncMode
Any child components of the AsyncMode tag will now make those childrens updates asynchronous, treating them as low priority updates.

Life Cycle Methods Are Changing
componentWillMount, componentWillUpdate, componentWillReceiveProps will be deprecated and prepended with UNSAFE_
All Will methods will be deprecated, except for componentWillUnmount
Why? Confusion in use cases, performance and to make way for the upcoming Async Mode!

Where to?
componentWillMount goes to componentDidMount
componentWillUpdate goes to componentDidUpdate
componentWillReceiveProps goes to getDerivedStateFromProps (new and shiny method which is a static function)

forwardRef function from the React Class, takes props and ref parameters.
String refs will be deprecated, due to perf issues and others

New React Developer Tools Released
Now that there is some new stuff to work with, React Developer Tools has been updated to assist with debugging these new components.

Software

Podcast Gear

Video Gear

Computer Gear

Recommended Gear

Other Gear
Рекомендации по теме
Комментарии
Автор

Good thing about being to wrap in strict is to be able to progressively update your code rather than be hit by a million warnings at once

mattpatterson