Skip to content

Reactjs reactive store with ES6 Proxy πŸ”₯πŸ”₯πŸ”₯

Notifications You must be signed in to change notification settings

barrypeng6/react-proxy-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

React Proxy Store

Reactjs reactive store with ES6 Proxy πŸ”₯πŸ”₯πŸ”₯

Installation

> npm install react-proxy-store

Usage

// choose one
const ObserverState = require('react-proxy-store') //es5
import ObserverState from 'react-proxy-store' //es6

class App extends Component {
  constructor() {
    super();

    const initialState = {
      num: 0
    }
    this.state = Observer(initialState, this.update.bind(this))
  }
  update() {
    this.forceUpdate()
  }
  componentDidMount() {
    this.state.num = 1  
  }
  render() {
    return (
      <div>{ this.state.num }</div>
    )
  }
}
// re-render and num = 1

License

MIT

About

Reactjs reactive store with ES6 Proxy πŸ”₯πŸ”₯πŸ”₯

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published