Using the different features of Jotai
So far, we've learned some basics of the Jotai library. There are some more basic features that we will cover in this section. These features are necessary if you need to deal with complex scenarios. We'll also briefly introduce some advanced features whose use cases are out of the scope of this book.
In this section, we'll discuss the following topics:
- Defining the
write
function of atoms - Using action atoms
- Understanding the
onMount
option of atoms - Introducing the
jotai/utils
bundle - Understanding library usage
- Introduction to more advanced features
Let's take a look at each one now.
Defining the write function of atoms
We have seen how to create a derived atom. For example, doubledCountAtom
with countAtom
is defined in the Understanding how Jotai works to store atom values section, as follows:
const countAtom = atom(0); const doubledCountAtom = atom( (get) => get...