Compose Jotai Atoms to Update Atom Values From Different React Components

InstructorDaishi Kato

Share this video with your friends

Send Tweet

We added the ability to select an SVG by creating a new atom that holds an atom that you select. With this we can build additional functionality like setting the color of the SVG path.

In this lesson, we will update ShapeAtom to have an optional color property and create a new atom to set that property. You'll see how we can create a Controls Component that will interact with an SVG Path component through the setColorAtom atom. We can get the currently selected path with selectedShapeAtomAtom and control the properties of the atom within.