4 ms·
I use hooks the way you do for independent information, but when the states are related (like a userID and a userName for example), then it's better to have the
by roastnewt 5y ago
I use hooks the way you do for independent information, but when the states are related (like a userID and a userName for example), then it's better to have them as properties in the same object. If they tend to both change at the same time, that could cause a double re-render, as well as temporarily having an inconsistent state when one has updated but the other hasn't yet.