Derived State In React
Topic | Source |
---|---|
๐งฉ React | React - Udemy |
If you have a variable that is dependent on another state variable, you don't need to create another state variable for this. It is sufficient, to create a normal local variable let
or const
for this.
The whole function component gets re-rendered anyway, when the state gets updated, so the local variable will get computed again as well.