|
|
|
|
|
by ratww
1504 days ago
|
|
> Any time you have props and state, updating props is best done by replacing the component by changing the key No, it isn't. This is a ludicrous statement. Replacing the key will RESET the internal state of children objects. Meaning you can't use this workaround for any component that has any kind of internal state does not come from props. See for yourself: https://codesandbox.io/s/compassionate-williamson-qezsw5?fil... On the other hand, it is completely trivial to update props that don't affect internal state. This article is only about updating props that affect internal state of components that don't have any other internal state. > All of this complexity is completely unwarranted No. All of this complexity you're complaining about exists for one very specific edge case, and this edge case exists in non-reactive frameworks too. You're just extrapolating the complexity of one single edge case to the whole framework. |
|