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

Is there a way to preserve class component state between code refreshes? #264

Open
davidyang opened this issue Sep 19, 2024 · 0 comments
Open

Comments

@davidyang
Copy link

I'm using shadow-cljs and re-rendering on file save. Is there a way to preserve component state between renders?

I've tried a few things without luck:

  • Writing a mixin that stores any atoms in state. The problem is that it's hard to get a unique key for a component that persists between renders
  • Wrapping the render with a functional component that contains a ref. I think React maintains this ref if fast-refresh is enabled, but that doesn't seem to work here.

Any other ideas on generating an id or signature that is unique to a component's position in the render tree would be appreciated!

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

1 participant