React API reminds of Microsoft COM for JavaScript. It was called Component Object Model. It was hell to deal with when lasted.
React v16.3.0: New lifecycles and context API
11–20 of 133 posts
Re: React v16.3.0: New lifecycles and context API
#12I like that they are taking the deprecation of the lifecycle methods slowly. And the automated script to migrate to the 'UNSAFE' version of those methods in 17 is a nice touch. I don't know if I love the new context API, but it's great they're giving an official option. Of the big JS frameworks that are popular at the moment, I think the React team is doing the best job of balancing new features with minimizing devel…
If anything, I think the new context API (and even forwardRef itself) are endorsements of the render prop pattern more than of HOCs. :)
Re: React v16.3.0: New lifecycles and context API
#13In the unlikely scenario of Facebook's demise, how do you think the maintenance of React would transpire? Do you think some other tech company would snatch up the design leads, and pick up the torch? Would it go into its own independent organization?
Re: React v16.3.0: New lifecycles and context API
#14Re: React v16.3.0: New lifecycles and context API
#15Summary: * Context overhaul that makes it way easier to pass state/props down multiple levels of components. Uses function as a child for the API * Adds React.createRef function to create refs. Creating refs through callbacks is still a thing for advanced cases, but this provides a more ergonomic API to replace the old clunky ref={(c) => this._yourthing = c} type callback. * Adds React.forwardRef, which solves the is…
Note: createRef doesn’t replace callback refs. It just offers a more ergonomic API for common use cases. There are still rarer cases where callback refs are useful. For example when you need to run a side effect on a node as it attaches and detaches. Also note: legacy lifecycles are not deprecated yet . You won’t see the warnings unless you opt in with . They will be officially deprecated in a future minor release wh…
You asked "Curious, what do you use it for?" in regard to componentWillReceiveProps
https://news.ycombinator.com/item?id=16695064
I use componentWillReceiveProps for just about everything - I had thought it was a fundamental part of the Redux flow. i.e. Redux updates, new props flow through the hierarchy, I pick that up in componentWillReceiveProps and make changes based on new props.
Is this not correct?
Re: React v16.3.0: New lifecycles and context API
#16Re: React v16.3.0: New lifecycles and context API
#17Earlier quoted context omitted.
Note: createRef doesn’t replace callback refs. It just offers a more ergonomic API for common use cases. There are still rarer cases where callback refs are useful. For example when you need to run a side effect on a node as it attaches and detaches. Also note: legacy lifecycles are not deprecated yet . You won’t see the warnings unless you opt in with . They will be officially deprecated in a future minor release wh…
Off topic but Dan - referring to your question to me yesterday I'm curious to your answer: You asked "Curious, what do you use it for?" in regard to componentWillReceiveProps https://news.ycombinator.com/item?id=16695064 I use componentWillReceiveProps for just about everything - I had thought it was a fundamental part of the Redux flow. i.e. Redux updates, new props flow through the hierarchy, I pick that up in comp…
Re: React v16.3.0: New lifecycles and context API
#18Earlier quoted context omitted.
Note: createRef doesn’t replace callback refs. It just offers a more ergonomic API for common use cases. There are still rarer cases where callback refs are useful. For example when you need to run a side effect on a node as it attaches and detaches. Also note: legacy lifecycles are not deprecated yet . You won’t see the warnings unless you opt in with . They will be officially deprecated in a future minor release wh…
Off topic but Dan - referring to your question to me yesterday I'm curious to your answer: You asked "Curious, what do you use it for?" in regard to componentWillReceiveProps https://news.ycombinator.com/item?id=16695064 I use componentWillReceiveProps for just about everything - I had thought it was a fundamental part of the Redux flow. i.e. Redux updates, new props flow through the hierarchy, I pick that up in comp…
What you're describing sounds more like you're updating something external (e.g. your Redux store). This isn't what the lifecycle is meant for, and you'd be better off using componentDidUpdate instead.
Re: React v16.3.0: New lifecycles and context API
#19Earlier quoted context omitted.
Note: createRef doesn’t replace callback refs. It just offers a more ergonomic API for common use cases. There are still rarer cases where callback refs are useful. For example when you need to run a side effect on a node as it attaches and detaches. Also note: legacy lifecycles are not deprecated yet . You won’t see the warnings unless you opt in with . They will be officially deprecated in a future minor release wh…
Off topic but Dan - referring to your question to me yesterday I'm curious to your answer: You asked "Curious, what do you use it for?" in regard to componentWillReceiveProps https://news.ycombinator.com/item?id=16695064 I use componentWillReceiveProps for just about everything - I had thought it was a fundamental part of the Redux flow. i.e. Redux updates, new props flow through the hierarchy, I pick that up in comp…
Re: React v16.3.0: New lifecycles and context API
#20I like that they are taking the deprecation of the lifecycle methods slowly. And the automated script to migrate to the 'UNSAFE' version of those methods in 17 is a nice touch. I don't know if I love the new context API, but it's great they're giving an official option. Of the big JS frameworks that are popular at the moment, I think the React team is doing the best job of balancing new features with minimizing devel…
This just isn’t true. Abstracting form logic. Request logic. Anything else you use across your app. Connect in redux. There are hundreds of good reasons to have a higher order component.
It makes testing easy. Test your request logic in one place, anything that uses it is now a stateless component, and testing it is trivial.