Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

omerman/jotai-nexus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Archived in favor of Jotai's Provider & Store

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.

Method Returns
readAtom getter
writeAtom setter function, pass value to be set as second parameter

About

No description, website, or topics provided.

Resources

License

Stars

11 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors