(refactor/react): Memoize ComponentScope unique value with useState to ensure referential stability.#73
Conversation
…o ensure referential stability.
|
Thank you for the PR |
|
Do you think this is possible to have a failing test without this fix ? As I can see from the doc (https://react.dev/reference/react/useMemo) :
|
|
Well I didn't succeed in doing a test case but you are right : |
Description of the change
According to React Docs,
useMemo's result can be forgotten under special circumstances. To avoid this potential behavior, we could useuseStateto create a stable reference to both the tuple and the generated value at the same time. What do you think?Type of change