Using Jotai for ListOfFavoritedImages
You may have noticed that we didn’t give much of a theoretical introduction to Jotai. This is because this library is minimal. There is no boilerplate, no complex concepts. All we need to do is create an atom and use it thanks to a custom hook in the app. Let’s start by creating an atom with some mock data for the liked images:
// src/atoms/imagesAtoms.js import { atom } from "jotai"; export const imageListAtom = atom([ { "itemId": 1, "authorId": 11, "timeStamp": "2 hrs ago", "url": "…", "likes": "28", "conversations": "12" }, { "itemId": 2, "authorId": 7, ...