Skip to content

What would be neat approach update atoms on component mount except using useEffect? #1488

Closed Answered by dai-shi
dante01yoon asked this question in Ideas
Discussion options

You must be logged in to vote

I'm not a big fan of useEffect

Me, neither.

There is need to save refs in atom.

But, in this case, useEffect or callback ref will be necessary.

what would be best approach with Jotai?

This is a tough one..
Jotai atoms are independent from DOM or even React.

Hm, I think your atom and an HTML element is one-to-one relationship? In that case, we could use traditional style? i.e. getElementById. I'm not saying it's best. Just exploring. Or, maybe atom has an id.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@dante01yoon
Comment options

@dai-shi
Comment options

@dante01yoon
Comment options

@dai-shi
Comment options

@dante01yoon
Comment options

Answer selected by dante01yoon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants