|
|
|
|
|
by dragonwriter
1730 days ago
|
|
> When the component needs to manage user interactions it needs state, and then if you need to update props you have to make a new instance of the component That would suck and make React completely unusable, but it isn't true at all. Assuming that there are necessary state/prop interactions to track (sometimes the two arr largely orthogonal, so you don't need this) you might need to add additional state variables to do last value tracking for props, and then do (with useEffect hooks in a function component, for instance) state updates based on prop changes as needed, but you don't need a new instance on prop changes, generally. |
|
https://reactjs.org/blog/2018/06/07/you-probably-dont-need-d...