So I am working on an app and I need to hide the Userform component until after they click the register button which is part of the Login component. This may be a simple question, but I am having a hard time with it.
This is my app.js
import React from 'react';
import './App.css';
import UserForm from './components/UserForm';
import Login from './components/Login.js';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
display: 'register',
acc: null
}
this.setAppState = this.setAppState.bind(this);
}
setAppState(event) { this.setState(event) }
render() {
const { display } = this.state;
switch(display) {
case 'register':
return <div className="App">
<UserForm
setAppState={this.setAppState}
/>
</div>
case 'login':
return <div className="App">
<Login
setAppState={this.setAppState}
/>
</div>
default:
}
}
}