Conditionally apply display block and show in reactjs
How to conditionally apply display block and show
Example
import React, { useState } from "react";
export default function App() {
const [show, setShow] = useState(false);
return (
<>
<div style={{ display: show ? "none" : "block" }}>
<h1>First page</h1>
<button onClick={() => setShow(true)}>Show Second Page</button>
</div>
<div style={{ display: show ? "block" : "none" }}>
<h1>Second page</h1>
</div>
</>
);
}