{"repo":"pmndrs/jotai","free":true,"listed":false,"github":"https://github.com/pmndrs/jotai","clone":"git clone https://github.com/pmndrs/jotai.git","description":"👻 Primitive and flexible state management for React","language":"TypeScript","stars":21239,"topics":["react","state","management","atomic","hacktoberfest"],"license":"MIT","category":"ui-components","readme_excerpt":"visit jotai.org or npm i jotai Jotai scales from a simple useState replacement to an enterprise TypeScript application. - Minimal core API (2kb) - Many utilities and extensions - No string keys (compared to Recoil) Examples: Demo 1 Demo 2 First, create a primitive atom An atom represents a piece of state. All you need is to specify an initial value, which can be primitive values like strings and numbers, objects, and arrays. You can create as many primitive atoms as you want. Use the atom in your components It can be used like React.useState : Create derived atoms with computed values A new read-only atom can be created from existing atoms by passing a read function as the first argument. get allows you to fetch the contextual value of any atom. Creating an atom from multiple atoms You can combine multiple atoms to create a derived atom. Or if you like fp patterns ... Derived async atoms You can make the read function an async function too. You can create a writable derived atom Specify a write function at the second argument. get will return the current value of an atom. set will update the value of an atom. Write only derived atoms Just do not define a read function. Async actions Just make the write function an async function and call set when you're ready. Note about functional programming Jotai's fluid interface is no accident — atoms are monads, just like promises! Monads are an established pattern for modular, pure, robust and understandable code which is optimized for","default_branch":null,"files":null,"tree":[],"storefront":"/r/pmndrs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/pmndrs/jotai/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}