0.0.8 • Published 4 years ago

statezero-react-hooks v0.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

statezero-react-hooks

React hooks for statezero.

Getting Started

Install from npm.

# Install peer dependencies
npm install react --save
npm install statezero --save

npm install statezero-react-hooks --save

ES6 Module

import { useStatezero } from 'statezero-react-hooks';

ES6 Module with tree shaking (not transpiled)

// Note that the import path ends with '/src'
import { useStatezero } from 'statezero-react-hooks/src';

Usage

Provides the following functions:

import { useStatezero, useStatezeroPath, useStatezeroPathSync, useStatezeroSync } from 'statezero-react-hooks';

let state, setState;
state = useStatezero(selector);
state = useStatezeroSync(selector);
[state, setState] = useStatezeroPath(path);
[state, setState] = useStatezeroPathSync(path);

Example React components

import { useStatezero, useStatezeroPath } from 'statezero-react-hooks/src';

export const component = ({ selector }) => {
  const state = useStatezero(selector);
  // ...
}

export const component = () => {
  const [z, setZ] = useStatezeroPath('x.y.z');
}
0.0.8

4 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago