In this repo you have found out how I made Hotel Booking app using React
Step1: Importing the ReactHook
import React, { useState } from 'react';
Step2: Using that useState Hook that we imported
const [first, setfirst] = useState() - You can choose to leave the useState() blank or add a boolean either true or false
example of using false at the useSate function
const [first, setfirst] = useState(false)
example of using true at the useSate function
const [first, setfirst] = useState(true)
Swithcing between pages with useSate Hook
import Home from './Home';
import About from './About';
function App() {
const [first, setfirst] = useState(true)
const [second, setsecond] = useState(true)
let Home = document.querySelector(".Home");
let About = document.querySelector(".About");
setfirst(!first + wrapper.classList.add("hide"));
setsecond(!second + container.classList.add("show"));
return (
<div className="App">
<Home /> {/* This is your HomePage */}
<About /> {/* This is your aboutPage */}
</div>
{/* Note that you'll have to export those page on their root file */}
)
}