need help with navbar and contents in reactjs
NavBar Component
HomePage Component
About Component
So I want the navbar to be placed in same tol place throughout the entire reactpage
27 Replies
This is app.js
It work in browserRoutes but I applied height 100dvh and width 100% with flex property for my main content page in css
Why u did not put navBar component inside the Routes?
Where is it supposed to be
I want that navbar to be in that top place all the time , even I enter about page it should be in that place and if I enter in home page it should be in that place
Lemme try that
Maybe dont render navBar here in app.js
But inside the other components you want to render
I put
<Routes>
<Navbar />
</Routes>
It doesn't load anything
But will the styles of other components will affect that ? Like height
U did not give the properties like path and element
I dont know try that
The position should be fixed or what?
Fixed
Okay first try that thing i told u
Because i think ain’t good looking
If u put two navs
In app . Js
So should I add navbar in home and contact component??
Yes
Try it
I tried
So?
It works just like that in app.js
so it is not solved
Where is the problem and what u want to achieve
I'm not good in English , lemme ask in AI and give u the proper English
Okay
The <Navbar /> should always be visible at the top, and the <Footer /> should always be visible at the bottom. They should not be rendered conditionally. When clicking on the links in the navbar (Home, About, Contact), the corresponding content should render in between the navbar and footer.
Here
Then just put inside those components Navbar and Footer?
Thats my idea
Try it
I dont know any better
inside home, about components
?*
Yeah
I tried the first method u say
Putting component in Routes and I use Links
Did it work
Yes it works
Thanks