The landing page in my app has 2 states: sign_in and sign_up: const [loginForm, setLoginForm] = useState(true);
In my JSX I have:
return (
<LoginFormContainer>
<LoginCheckBody />
{loginForm ?
// stuff when sign_in form should show
:
// stuff when sign_up form should show
}
</LoginFormContainer>
)
In the stuff when I have buttons to switch the loginForm state. Now I want to add a third option: forgot_password.
I have to change to the loginForm to a string and instead of passing booleans, pass string values. But I wondering how to resolve that in the JSX. Now I'm using a ternary condition to toggle between 2 states but that won't work.
I kinda want to use a switch to display a form corresponding to the set value of loginForm. Any suggestions?
x ? a : y ? b : c.