1.0.7 • Published 2 years ago

jotai-nexus v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

J O T A I - N E X U S

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.

Install

npm

npm i jotai-nexus

yarn

yarn add jotai-nexus

Usage

1. Add JotaiNexus to your main React file.

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;

2. Use the following methods to get/set values passing your atom as a parameter.

MethodReturns
readAtomgetter
writeAtomsetter function, pass value to be set as second parameter
1.0.7

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago