reactjs - 我无法跳到其他步骤
问题描述
使用 StepZilla,我无法跳到其他步骤...我没有使用任何浏览器会话,这里我使用的是 redux 商店。
import React from 'react';
import StepZilla from 'react-stepzilla';
import ThankyouStep from './ThankyouStep.js';
import Purchase from './PurchaseStep.js';
import Configure from './ConfigureStep.js';
import {connect} from 'react-redux'
import {selectMainWizardStep} from '../../Actions/WizardActions'
require('../../styles/css/Wizard.css');
class MainWizard extends React.Component {
render() {
const steps =
[
{ name: 'Purchase', component: <Purchase /> },
{ name: 'Configure', component: <Configure organizationId = "121334-11-0000000000000" /> },
{ name: 'Thank You', component: <ThankyouStep /> },
];
在成功填写“购买”选项卡后,我希望它跳转到“配置”选项卡。但这种跳跃并没有发生。在这里,我注释了两行,因为那是使用浏览器会话。使用浏览器会话,我能够跳转到配置步骤。但是由于页面刷新,redux 状态正在丢失。这就是为什么我使用 redux 商店,但我无法跳转到配置页面。
return (
<article className='step-progress'>
<StepZilla
steps={steps}
preventEnterSubmission={true}
nextTextOnFinalActionStep={'Save'}
hocValidationAppliedTo={[3]}
//startAtStep={window.sessionStorage.getItem('step') ? parseFloat(window.sessionStorage.getItem('step')) : 0}
startAtStep = {this.props.Wizard.selectedWizradStep}
//onStepChange={(step) => window.sessionStorage.setItem('step', step)}
onStepChange = {(step) =>this.props.selectMainWizardStep(step)}
showNavigation={false}
/>
</article>
);
}
}
function mapStateToProps(state) {
return {
Wizard: state.Wizard
};
}
const mapDispatchToProps = {
selectMainWizardStep
};
export default connect(mapStateToProps, mapDispatchToProps)(MainWizard);