I have a component that I want to display once the user loads the website. Then if they click to close it shouldn't display. What's the best way to do this by using ComponentDidMount()? I assume the click out state should be in componentDidMount?
class App extends Component {
constructor(props){
super(props);
this.state = {
wasShown: false
}
console.log(this.props)
}
componentDidMount() {
}
render(){
return (
<div>
{ !wasShown ? <MyComponent /> : '' }
</div>
);
}
};