Skip to content

React library to access global variables using a hook

License

Notifications You must be signed in to change notification settings

imod-ch/react-global

Repository files navigation

react-global CI npm version

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

Contributors