3 April 2024


Jotai Tips

Learn Jotai with handy tips!
Share on:


I’ve been sharing tips about Jotai on Twitter, calling them “Jotai tips.” As tweets tend to get lost over time, I thought it would be good to have all these tips in one place.

So, here we go.

Tip 1: Primitive-like atoms

Tip 2: Early return

Tip 3: Promise value

Tip 4: Store API

Tip 5: useAtom

Tip 6: Derived-like atoms

Tip 7: Atom depending on props

Tip 8: Atom with local storage

Tip 9: Swap atom

Tip 10: Write chain

Tip 11: Promise.all in async atoms

Tip 12: Toggle atom

Tip 13: Two args

Tip 14: Selected item atom

Tip 15: Optimize rendering with two atoms

Tip 16: Use atom conditionally

Tip 17: Atom creator

Tip 18: Refresh atom

Tip 19: Default atom

Tip 20: Async only initially

Closing notes

How was it? Did you enjoy the Jotai puzzle?

comments powered by Disqus