In reactjs in below program how can we assign \'c\' using setState. Please sugge
ID: 3887367 • Letter: I
Question
In reactjs in below program how can we assign 'c' using setState. Please suggest me the correct syntax. HandleSubmit is called in onClick for a button.
handleSubmit=(event) => {
event.preventDefault();
var v= validator(this.state, this.constraints);
if(v){
this.setState(Object.assign(this.state,{error:v}));
console.log(v);
}
else{
if(this.state(actions.permission)=="no")
{
var t=this.props.t;
tet c={};
c=(<div>
<Modal ref="modal">
<h2>Are you sure you want to continue</h2>
<Modal>
<div>);
this.setState(object.assign(this.state,{c}));
}
}
Thanks in advance
Explanation / Answer
hi you can probably do it in this way
this.setState(state1)
hope this works thanks
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.