Keeping states between pages in a React application can be tricky. This article explains how to keep states persistent in a Next.js based React application using Recoil.js. Before reading this article, one should have a basic understanding of React.

Next.js is a React-based framework for building complete web applications. Next.js provides more functionalities (such as styling and routing solutions) than your typical create-react-app for faster and easier web app building.

As a react-based application, state management can be done using built-in state (setState or useState) and props, or context. However, as the application becomes bigger (longer component tree) and more complex, you would need the help of third-party libraries for state management.

Enter Recoil.js

Full disclosure: there are many state management libraries for React out there and Recoil is one of the recent ones created. The use of these state management libraries is subject to the developer’s own need and opinion. I, personally, choose Recoil because of its simplicity and functionality.

#recoil #recoiljs #nextjs #react #reactjs

How to Use Recoil.js Library in Next.js Framework
52.95 GEEK