小编Mih*_*hai的帖子

使用Redux,React和react-router-dom 4.x时从动态组件获取ref

我有以下课程

class MatchBox extends React.Component {
    constructor(props) {
        super(props);

        this.countdownHandler = null;
        this.showBlocker = true;

        this.start = this.start.bind(this);
    }

    start() {
        ...
    }

    render() {
        ...

        return (
            <div style={ styles.mainContainer } className="fluid-container">
                ...
            </div>
        );
    }
};

function mapStateToProps(state) {
    ...
}

function matchDispatchToProps(dispatch) {
    ...
}

export default withRouter(connect(mapStateToProps, matchDispatchToProps, null, { withRef: true })(MatchBox));
Run Code Online (Sandbox Code Playgroud)

这个课程中使用的

class GameBox extends React.Component {
    constructor(props) {
        super(props);

        ...
    }

    render() {
        var mainElement = null;
        switch(this.props.mainElement.element) {
            case 'SEARCHING': mainElement = …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-router redux react-router-v4

5
推荐指数
1
解决办法
1077
查看次数