Archived in favor of Jotai's Provider & Store
Inspired by Recoil Nexus
This package gives you the ability to access atom's, e.g read/write to them from outside React's tree.
npm
npm i jotai-nexus
yarn
yarn add jotai-nexus
import React from "react";
import JotaiNexus, { readAtom, writeAtom } from "jotai-nexus";
// Somewhere in your code use readAtom(myAtom) or writeAtom(myAtom, myUpdate)
export default function App() {
return (
<SomeLayout>
{/* ... */}
<JotaiNexus />
</SomeLayout>
);
}
export default App;
Method | Returns |
---|---|
readAtom |
getter |
writeAtom |
setter function, pass value to be set as second parameter |