从redux状态更新本地状态?store.subscribe未在stepzilla中调用更新步骤

时间:2018-05-24 04:48:21

标签: reactjs react-redux

我必须使用redux状态来维护stepzilla中的步骤状态。

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

    this.state = {
      CurrentWizardStep : 0,
    };

    store.subscribe(() => {
        console.log('Inside subscribe')
        this.setState({
            CurrentWizardStep : store.getState().selectedWizradStep
        });
      });
    }
render() {
    const steps =
        [
            { name: 'step1', component: <step1/> },
            { name: 'step2', component: <step2 /> },
            { name: 'step3', component: <step3 /> },
        ];
    return (
        <article className='step-progress'>
            <StepZilla
                steps={steps}
                preventEnterSubmission={true}
                nextTextOnFinalActinonStep={'Save'}
                hocValidationAppliedTo={[3]}
                //startAtStep={window.sessionStorage.getItem('step') ? parseFloat(window.sessionStorage.getItem('step')) : 0}
                startAtStep = {this.state.CurrentWizardStep}
                //onStepChange={(step) => window.sessionStorage.setItem('step', step)}
                showNavigation={false}
            />
        </article>
    );
}

}

redux状态正在进行更新,但在调度后,store.subscribe没有被调用?

提前致谢。

Shraddha

0 个答案:

没有答案