Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abhishiv/atom

Simple atom structure inspired by clojure's atom. Mutations are JSON RFC 6902 patches.
https://github.com/abhishiv/atom

atom atom-structure jsonrfc6902

Last synced: 30 days ago
JSON representation

Simple atom structure inspired by clojure's atom. Mutations are JSON RFC 6902 patches.

Awesome Lists containing this project

README

        

# @gratico/atom

@gratico/atom
=====

Simple atom structure inspired by clojure's atom. Mutations are JSON RFC 6902 patches.

Install and use
---------------

To use run `npm install -g @gratico/atom`

import {defAtom, commitPatch, defCursor, deref, defWatchableCursor} from "@gratico/atom"

const atom = defAtom({user: {profile: {name: "John"}}})

React.useLayoutEffect(() => {
const cursor = defWatchableCursor(atom, ["user", "profile"]);
cursor.addWatch(id, handler);
return () => {
cursor.removeWatch(id);
};
}, []);

```
export * from "./atom";

```