Experimental Rescript bindings to recoil.
Create an atom:
let todoListState = Recoil.Atom.value(~key="todoListState", ~default=[||]: array(Todo.t), ())->Recoil.Atom.make;
Create a getter:
let filteredTodoListState =
Recoil.Selector.value(
~key="filteredTodoListState",
~get=({get}) => { ... },
(),
)
->Recoil.Selector.make;
Create a setter:
let filteredTodoListState =
Recoil.Selector.value(
~key="filteredTodoListState",
~get=({get}) => { ... },
~set=({get, set}) => { ... },
(),
)
->Recoil.Selector.make;
- clone this directory
- yarn install
- yarn dev
- go to http://localhost:1234
example directory contains the todo app from the recoil doc
Code doc is copied from recoil documentation site.