Skip to content
/ Neuron Public

Neuron Global State Manager for Javascript Apps

Notifications You must be signed in to change notification settings

hjrdave/Neuron

Repository files navigation

npm version build npm bundle size

Neuron Global State Manager

The Neuron Global State Manager is a small, bare bones, framework agnostic library for building framework specific global state managers.

Neuron Core can be used in any js application by itself or you can tailor it to your framework of choice. My goal is to create framework specific version of this that use core under the hood. See React Neuron as an example.

Warning: This library is still experimental and is not ready for production.

Setup Neuron State

Create a new Neuron

import { Neuron } from "@sandstack/neuron";

const trainer = new Neuron("Ash Ketchum");

Update state

trainer.set("Gary Oak");

Get state

const name = trainer.getRef();

Listen for state changes

trainer.effect((payload) => {
  console.log(payload.state);
});

//initial console.log output
//name: Ash Ketchum

//new console.log output
//name: Gary Oak

Learn more about Neuron Core and React Neuron.

About

Neuron Global State Manager for Javascript Apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published