Setup
Reatom is a framework-agnostic state manager, and you can use it with various adapters for different frameworks. This guide provides a common usage with React.js, as it is the most commonly used view library currently.
Create new project from template
#The base template project includes Vite, TypeScript, React and Reatom ecosystem: https://github.com/artalar/reatom-react-ts
You could try it online: codesandbox, stackblitz, gitpod
To setup it in your machine you can use degit package.
Add to existing project
#With React
#Installation
#You need to set up the main context and put it into the provider at the top of your application.
Usage
#The useAtom
function allows you to have an experience similar to useState
, but with shared atom state.
Also, you can create computed atoms (kind of selectors) right inside useAtom
.
This is very basic functionality of reatom-react bindings, see more in @reatom/npm-react package documentation