compx
State manager for react
Last updated a year ago by kristinn93 .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install compx 
SYNC missed versions from official npm registry.

CompX - Still in active development / Incomplete

Due to lack of interest and motivation, this library won't be developed any further

Very simple react state management library that uses react setState to populate a global state accessible to other components

Usage

Provider

import { Provider } from 'compx';
...
render() {
    return (
      <Provider>
        <ComponentA />
        <ComponentB />
      </Provider>
    );
}

Connect

  • ComponentA
import React, { Component } from 'react';
import {Connect} from 'compx';

class ComponentA extends Component {
    constructor(props) {
        super(props);
        this.state = {
            number: 0;
        }
    }
    render() {
        <button>Counter: {this.state.number}</button>
    }
}
export default Connect()(ComponentA);
  • ComponentB
import React, { Component } from 'react';
import {Connect} from 'compx';

class ComponentB extends Component {
    render() {
        <p>ComponentA counter is {this.props.CompX.ComponentA} </p>
    }
}
export default Connect({subscribeTo: ['ComponentA']})(ComponentB);

Current Tags

  • 0.0.9                                ...           latest (a year ago)

9 Versions

  • 0.0.9                                ...           a year 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
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 12
Last Day 0
Last Week 1
Last Month 3
Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |