@imod-ch/react-global
v1.1.1
Published
React library to access global variables using a hook.
Downloads
152
Readme
react-global
React library to access global variables using a hook.
Installation
npm install @imod-ch/react-global --save
# or
yarn add @imod-ch/react-global
Usage
import { FC } from 'react';
import { useGlobal } from '@imod-ch/react-global';
const SampleComponent: FC = () => {
const [globalVariable, setGlobalVariable] =
useGlobal<string>('globalVariable');
return <p>{globalVariable}</p>;
};
License
MIT