DEV Community

Discussion on: The most common mistakes when using React

Collapse
 
clarity89 profile image
Alex K.

Thanks for the feedback :) My point was more about keeping state and it's usage consistent, e.g. do not declare something as an array and access it as an object. But for small cases like having a name defined on a user object, it sometimes does make sense imo. What I did not mean is to have the whole complex state structure set out in the initial state. In that case it's better to use thorough validations when accessing it or delaying accessing the state until all the data is loaded. Should have probably made it more clear in the article :)