I've got a method called devCreateSteps and I want to use state in that but it throws an error saying;
Uncaught TypeError: Cannot read property 'isTemplateUsed' of undefined
Here's the snippet of my code;
constructor() {
super();
this.state = {
modalVisible: false,
tableLoading: false,
modalHeader: "",
isTemplateUsed: false
};
}
devCreateSteps = [{
title: 'Info',
content: (<StepOne isTemplateUsed={this.state.isTemplateUsed} />),
}, {
title: 'Device',
content: (<StepTwo />),
}, {
title: 'Location',
content: (<StepThree />),
},
{
title: 'Properties',
content: (<StepFour />),
},
{
title: 'Controls',
content: (<StepFive />),
},
{
title: 'Summary',
content: (<StepFinal />),
}];
The problem is I can't use
isTemplateUsed={this.state.isTemplateUsed}
this in the devCreateSteps
What is the right way to use state to send it as props ?
stateforStepOnecomponentstateis a class prop also, not done in constructor.