Hacker News new | ask | show | jobs
by enricozb 1383 days ago
Similarly to how React does it I'd imagine. There is a static vector of `State` elements that is initially empty and is filled on the first render with each call to use_state. When calling use_state on subsequent renders, this vector is read from. This is also why, like React, use_state calls must always be in the same order across renders.