I am trying to use React hooks to display a component when a button is pressed. I'm sure this is some simple syntax wrong here. Any guidance?
const [displayComponent, setDisplayComponent] = useState(null);
function sendComponent() {
setDisplayComponent(
displayComponent = {<TheImportedComponentIWantToDisplay/>}
)
}
return (
<Button onClick={sendComponent} >Push to render component</Button>
{displayComponent}
)