The Second part i.e sign up part is not rendering
The intention is to get the span being changed on click each tab i.e sign ,sign up and forget This is the main class and the form class is called in it. The below code is the original code used to render in the screen
class App extends React.Component {
constructor(props) {
super(props);
// this.setOptionSignIn = this.setOptionSignIn.bind(this);
// this.setOptionSignUp = this.setOptionSignUp.bind(this);
// this.setOptionForget = this.setOptionForget.bind(this);
this.state = {
option : 1
}
}
setOptionSignIn = () => {
this.setState(()=> {
return {
option : 1
}
})
}
setOptionSignUp = () => {
this.setState(()=> {
return {
option : 2
}
})
}
setOptionForget = () => {
this.setState(()=> {
return {
option : 3
}
})
}
render() {
return (
<div className="container">
{
console.log(this.state.option+"before and type is "+ typeof this.state.option)
}
<header className={
`header-headings ${this.state.option === 1 ? 'sign-in' : this.state.option === 2 ? 'sign-up' : 'forgot'}`}>
<span>Sign in to your account</span>
<span>Create an account</span>
<span>Reset your password</span>
</header>
{
console.log(this.state.option+"after and type is "+ typeof this.state.option)
}
<ul className="options">
<li className={this.state.option === 1 ? 'active' : ''} onClick={this.setOptionSignIn}>Sign in</li>
<li className={this.state.option === 2 ? 'active' : ''} onClick={this.setOptionSignUp}>Sign up</li>
<li className={this.state.option === 3 ? 'active' : ''} onClick={this.setOptionForget}>Forget</li>
</ul>
<Form optionState={this.state.option} />
</div>
)}
}
this.state.option === 1 ? "sign-in": (this.state.option === 2 ? "sign-up" : "forgot")console.log("state is and type is" , this.state.option , typeof this.state.option)header-headings ${this.state.option === 1 ? 'sign-in' : this.state.option === 2 ? 'sign-up' : 'forgot'}}> <span>Sign in to your account</span> <span>Create an account</span> <span>Reset your password</span> </header> { console.log(this.state.option+"after and type is "+ typeof this.state.option) }