The React Hook Proposal

What do you think about React's new hook proposal?

You can read about it here

The RFC is also online.

I like how it composes much nicer than classes and seems like a clean solution to the main problems React faces.

But does it replace the current API with something more complicated?

Did you find this post useful? Show some love!
DISCUSSION (4)

does it replace the current API with something more complicated?

AFAIK, Facebook (FB) doesn't have a plan to phase out class based components.

I believe FB is pushing people toward writing more composable components & behaviors (hooks), creating meaning smaller components (just like Functional Programming promotes writing small functions and compose them together).

React might become more "complicated" but the architecture your site would be more manageable & readable.

Haven't tried it out yet, but was listening to a brief overview from Kent C. Dodds and one example that comes to mind is componentDidMount (sync) vs useEffect (async), so there appears to be performance benefits to using hooks.

I'd also guess that since everything is a function now, it would be easy to mock hooks via jest, if necessary.

Gonna get back to day 1's live stream now πŸ˜‰

As with most their recent changes, I feel like they are veering too far towards solving complex problems that happen at Facebook scale, at the cost of making it more complex for the 99% of other use cases.

"Redux" has the same issue. People tend to use it early in the project creating a complicated (not complex) source code structure.

"Hooks" should be introduced gradually only when needed (but doubtful people would follow πŸ˜›)

Classic DEV Post from May 3

Evergreen skills to use throughout your career?

What are the skills that'd last throughout your career?

K πŸ‘“
Web/Mobile/Serverless - Consultant

How well do you know your own code?

Sign up (for free)