Skip to content

Latest commit

 

History

History
50 lines (46 loc) · 1.4 KB

File metadata and controls

50 lines (46 loc) · 1.4 KB

Hotel Booking App

In this repo you have found out how I made Hotel Booking app using React

Things to look out for

  • I have linked all pages using import/export statement
  • I have used firebase to store data
  • Using React useStae Hooks to change between pages

    Use UseState Hook to change between page

    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 */}
    )
    }