JSPM

  • Created
  • Published
  • Downloads 450
  • Score
    100M100P100Q93406F
  • License MIT

history mixin for react

Package Exports

  • react-history

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-history) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-history

history mixin for react

Features

  • auto restore your mounted state when re-render

Examples

import mixin from 'es6-react-mixins'
import History from 'react-history'

class App extends mixin(History) {
    componentWillMount() {
        super.componentWillMount()
        //it won't be called when re-render
        Actions1.gets()
    }
    componentDidMount() {
        super.componentDidMount()
        //it won't be called when re-render
        Actions2.gets()
    }
    onClick() {
        Actions3.gets()
    }
    render() {
        return (
            <div>
                {this.state.data_from_action1}
                {this.state.data_from_action2}
                {this.state.data_from_action3}
                <button onClick={this.onClick.bind(this)}></button>
            </div>
        )
    }
}