0.0.8 • Published 6 years ago

statezero-react-hooks v0.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
6 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

6 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago