Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useTrackedState causing re-render? #195

Closed
mewtwoo opened this issue Sep 7, 2023 · 2 comments
Closed

useTrackedState causing re-render? #195

mewtwoo opened this issue Sep 7, 2023 · 2 comments

Comments

@mewtwoo
Copy link

mewtwoo commented Sep 7, 2023

https://codesandbox.io/s/clever-cerf-588tt9

Every time I click the button to update state in Age component, the Name component console.count to Console.

@dai-shi
Copy link
Owner

dai-shi commented Sep 7, 2023

That's how it works.
It renders then bails out, and there's no commit (which is a costly task.)

Wrapping with useEffect leads to intuitive result.
https://codesandbox.io/s/optimistic-field-qspqd9

See also #177

@dai-shi
Copy link
Owner

dai-shi commented Mar 2, 2024

Closing as stale.

@dai-shi dai-shi closed this as completed Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants