Need help with react, and react-router.
Hey guys, I am working on a project, and I need some help. So basically in this project, the navbar and the hero-section or the first component of every page has to be wrapped under same div, because they both share the same background, and if I make them separate components, and apply background separately on them, the designs, aren't consistent.
for example let's say on Home Page, I have multiple sections, like Hero section, feature section, testimonials section, etc, now I want navbar and hero section to be a same component basically under the same div and other components to be out of it, because navbar and her-section for each page shares the same background.
How can I achieve it using React router and Shared Layouts ?
Here's what my current code looks like -
2 Replies
I may be understanding but if youll need the same navbar and hero on every page, why not make a NavBar.jsx and a Hero.jsx, then a component that holds them both