@stembord/state-react
TypeScript icon, indicating that this package has built-in type declarations

0.2.12 • Public • Published

ts-state-react

connect react components with state stores

Hooks

export const state = new State(INITIAL_STATE);
// Provider and Consumer from Context created with React.createContext
// useState is hook used to map state to props
export const { useState, Provider, Consumer, Context } = createHook(
  state.getState()
);
$ npm run todolist-hooks

Connect

export const state = new State(INITIAL_STATE);
// Provider and Consumer from Context created with React.createContext
// connect is used to map state to props
export const { Context, Provider, Consumer, connect } = createContext(
  state.getState()
);
$ npm run todolist-connect

Readme

Keywords

Package Sidebar

Install

npm i @stembord/state-react

Weekly Downloads

1

Version

0.2.12

License

(MIT OR Apache-2.0)

Unpacked Size

38.7 kB

Total Files

26

Last publish

Collaborators

  • jwaterfaucett
  • nathanfaucett