Better HN
topnewbestaskshowjobs
Log inSign up

roastnewt

2 karma · joined Dec 17, 2021 (4y ago) · 1 submissions

Submissions

comment 4y ago · link · parent

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.