Skip to content
alevnyacow edited this page Mar 24, 2022 · 3 revisions

Shared React variables provide you easy and comfortable mutable state management based on hooks. Basic example looks like this:

import { createUseSharedVariable } from "@alevnyacow/shared-react-variables";

const [useDummyVar] = createUseSharedVariable( { test: 0 } );

And then useDummyVar can be used as a React hook. It works like a mutable global state management, which means the following:

  • object which is returned by this hook can be modified, so it's mutable
  • this hook returns the same object wherever it's called, so it's global
Clone this wiki locally