Configuring Jotai in the Funbook app
If you’re a fan of simplicity, my dear reader, you may just fall in love with this state management library. Configuring it in our app only requires running the install
command in the terminal:
npm install jotai
Alternatively, see the following:
Yarn add jotai
There’s one hidden gem of configuration to be added: Suspense. I specifically used the word gem because this configuration requirement of Jotai will make your app crash less. Suspense is a new ReactJS functionality, created to only be able to render components that are ready to be rendered. As with any new functionality, the users need to get used to it, and sometimes need to be forced to try it. Jotai is doing exactly this: forcing the users to use Suspense, for their own good! Let’s go ahead and add it at the root of our app:
// ./App.js import React, { useState, Suspense } from "react"; export default function App() { //… ...