Skip to content

itstoreall/signal-state

Repository files navigation

Signal State

The State with GlobalContext GitHub branch

The State without GlobalContext GitHub branch

--

How to use:

  • Add a new state config in the states/index.ts
  • Add a new type of the state in the states/types.ts
  • Add this new type to the CustomType in the states/types.ts

--

Primitive values:

import state from '../signalState';

const stateNameValue = state.stateName.get();
state.stateName.set(value, delay)
state.stateName.isStore

Value is an object:

import \* as types from '../signalState/states/types';

const stateNameValue = state.third.get() as types.StateName;

return <div>{`Name: ${stateNameValue.name}`}</div>;