What would be neat approach update atoms on component mount except using useEffect? #1488
-
Hi, I'm not a big fan of useEffect, so I'm looking for another approach update atoms on component mount. There is need to save refs in atom. what would be best approach with Jotai? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Me, neither.
But, in this case, useEffect or callback ref will be necessary.
This is a tough one.. Hm, I think your atom and an HTML element is one-to-one relationship? In that case, we could use traditional style? i.e. |
Beta Was this translation helpful? Give feedback.
Me, neither.
But, in this case, useEffect or callback ref will be necessary.
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.