DEV Community

Cover image for Jotai Tips
Daishi Kato
Daishi Kato

Posted on • Originally published at blog.axlight.com

Jotai Tips

Learn Jotai with handy tips!

Introduction

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?

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post →

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️