@platform/state.react
React bindings for @platform/state.
Last updated 17 days ago by philcockfield .
MIT · Original npm · Tarball · package.json
$ cnpm install @platform/state.react 
SYNC missed versions from official npm registry.

Module License: MIT NPM banner

React bindings for @platform/state.

 

Install

yarn add @platform/state.react

To see example running in UI see @platform/state.react.tools

 

Getting Started

Define a model and create a store:

import { Store } from '@platform/state';

type IMyModel = {
  count: number;
};

type MyEvent = IIncrementEvent | IDecrementEvent;
type IIncrementEvent = { type: 'TEST/increment'; payload: { by: number } };
type IDecrementEvent = { type: 'TEST/decrement'; payload: { by: number } };


const initial: IMyModel = { count: 0 };
const store = Store.create<IMyModel, MyEvent>({ initial });

 

Configure consuming components to recieve the state-container context:

import { state } from '@platform/state.react'

export class MyView extends React.PureComponent {
  public static contextType = state.Context;
  public context!: state.ReactContext
  public store = this.context.getStore<IMyModel, MyEvent>();
}

 

Render the root of the tree with a context <Provider>:

export const Provider = state.createProvider(store);

export class MyRoot extends React.PureComponent {
  public render() {
    return (
      <Provider>
        <div>...</div>
      </Provider>
    );
  }
}

 

 

Current Tags

  • 0.4.123                                ...           latest (17 days ago)

118 Versions

  • 0.4.123                                ...           17 days ago
  • 0.4.119                                ...           2 months ago
  • 0.4.115                                ...           2 months ago
  • 0.4.114                                ...           3 months ago
  • 0.4.113                                ...           3 months ago
  • 0.4.111                                ...           3 months ago
  • 0.4.110                                ...           3 months ago
  • 0.4.109                                ...           3 months ago
  • 0.4.108                                ...           3 months ago
  • 0.4.107                                ...           3 months ago
  • 0.4.106                                ...           4 months ago
  • 0.4.104                                ...           4 months ago
  • 0.4.103                                ...           4 months ago
  • 0.4.102                                ...           4 months ago
  • 0.4.101                                ...           4 months ago
  • 0.4.100                                ...           4 months ago
  • 0.4.99                                ...           4 months ago
  • 0.4.98                                ...           4 months ago
  • 0.4.97                                ...           4 months ago
  • 0.4.95                                ...           4 months ago
  • 0.4.94                                ...           4 months ago
  • 0.4.93                                ...           4 months ago
  • 0.4.92                                ...           4 months ago
  • 0.4.90                                ...           4 months ago
  • 0.4.88                                ...           5 months ago
  • 0.4.87                                ...           6 months ago
  • 0.4.86                                ...           6 months ago
  • 0.4.83                                ...           6 months ago
  • 0.4.82                                ...           6 months ago
  • 0.4.81                                ...           6 months ago
  • 0.4.79                                ...           6 months ago
  • 0.4.77                                ...           6 months ago
  • 0.4.75                                ...           6 months ago
  • 0.4.68                                ...           7 months ago
  • 0.4.67                                ...           8 months ago
  • 0.4.64                                ...           9 months ago
  • 0.4.61                                ...           9 months ago
  • 0.4.57                                ...           10 months ago
  • 0.4.55                                ...           10 months ago
  • 0.4.54                                ...           10 months ago
  • 0.4.52                                ...           10 months ago
  • 0.4.50                                ...           10 months ago
  • 0.4.49                                ...           10 months ago
  • 0.4.48                                ...           10 months ago
  • 0.4.47                                ...           10 months ago
  • 0.4.45                                ...           10 months ago
  • 0.4.43                                ...           10 months ago
  • 0.4.42                                ...           10 months ago
  • 0.4.41                                ...           10 months ago
  • 0.4.39                                ...           a year ago
  • 0.4.37                                ...           a year ago
  • 0.4.34                                ...           a year ago
  • 0.4.31                                ...           a year ago
  • 0.4.30                                ...           a year ago
  • 0.4.29                                ...           a year ago
  • 0.4.28                                ...           a year ago
  • 0.4.25                                ...           a year ago
  • 0.4.22                                ...           a year ago
  • 0.4.20                                ...           a year ago
  • 0.4.16                                ...           a year ago
  • 0.4.15                                ...           a year ago
  • 0.4.14                                ...           a year ago
  • 0.4.13                                ...           a year ago
  • 0.4.10                                ...           a year ago
  • 0.4.8                                ...           a year ago
  • 0.4.7                                ...           a year ago
  • 0.4.6                                ...           a year ago
  • 0.4.4                                ...           a year ago
  • 0.4.3                                ...           a year ago
  • 0.4.2                                ...           a year ago
  • 0.4.0                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.25                                ...           a year ago
  • 0.2.23                                ...           a year ago
  • 0.2.21                                ...           a year ago
  • 0.2.20                                ...           a year ago
  • 0.2.19                                ...           a year ago
  • 0.2.18                                ...           a year ago
  • 0.2.17                                ...           a year ago
  • 0.2.16                                ...           2 years ago
  • 0.2.14                                ...           2 years ago
  • 0.2.11                                ...           2 years ago
  • 0.2.10                                ...           2 years ago
  • 0.2.7                                ...           2 years ago
  • 0.2.6                                ...           2 years ago
  • 0.2.5                                ...           2 years ago
  • 0.2.4                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.17                                ...           2 years ago
  • 0.1.16                                ...           2 years ago
  • 0.1.15                                ...           2 years ago
  • 0.1.14                                ...           2 years ago
  • 0.1.13                                ...           2 years ago
  • 0.1.12                                ...           2 years ago
  • 0.1.11                                ...           2 years ago
  • 0.1.10                                ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
  • 0.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 8
Last Day 0
Last Week 0
Last Month 11
Dependencies (2)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |