Add state

This commit is contained in:
Ray 2023-09-05 10:31:24 +00:00 committed by GitHub
parent 4501ff2638
commit f1e29a7ca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -29,13 +29,15 @@ const AuthNavItems = [
] ]
/// application states /// application states
const [nav, setNav ] = useState( navItems )
const saySomething = ( word ) => { const saySomething = ( word ) => {
alert( word ) alert( word )
} }
return ( return (
<div className="App"> <div className="App">
<Header /> <Header items={nav}/>
<Routes> <Routes>
<Route path="/" element={ <Home greeting="Hey you're at home!" /> } /> <Route path="/" element={ <Home greeting="Hey you're at home!" /> } />
<Route path="/about" element={ <About greeting="Hey you, this is about page!" handler={saySomething} /> } /> <Route path="/about" element={ <About greeting="Hey you, this is about page!" handler={saySomething} /> } />