if i have a react app setup like: //src/App.js import React from 'react'; import {…
- User
if i have a react app setup like:
//src/App.js import React from 'react'; import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import Home from './components/Home'; import MainApp from './components/MainApp';
function App() {
codereturn ( <Router> <> <Routes> <Route path="*" element={<Home />} /> <Route path="/app/*" element={<MainApp />} /> </Routes> </> </Router> );};
//src/components/Home.js import React from 'react'; import { Routes, Route } from 'react-router-dom'; import '../styles/Home.css'; import Header from './home/Header'; import Footer from './home/Footer'; import Content from './home/Content';
function Home() {
codereturn ( <div id="site" className="site"> <Header /> <main className="container-lg"> <Routes> <Route path="/" element={<Content />} /> </Routes> </main> <Footer /> </div> );}
export default Home;
//src/components/MainApp.js import { Routes, Route } from 'react-router-dom'; import '../styles/MainApp.css'; import Header from './main/Header'; import Footer from './main/Footer'; import Account from './main/Account';
function MainApp() {
codereturn ( <div id="app" className="app"> <Header /> <main className="container-lg"> <Routes> <Route path="/" element={<Account />} /> </Routes> </main> <Footer /> </div> );}
export default MainApp;
And as you can see their are two different .css file for the site design and app design. the issue im facing is i want the body background-color for home different then the app background-color. If i use body, it wont work. and if I use a I found this creates issues with the layout, since i need to use:
#app { background-color: var(--app-background-color); height: 100vh; }
the height in order for the color to fill in the background, this shift and effects my js code.
Any suggestions?
- Assistant
- User
this does not solve the issue of using "height: 100vh" which has negative impacts on the layout. i would perfer to use body tag
- Assistant
- User
Uncaught runtime errors: ERROR useLocation() may be used only in the context of a component.
- Assistant
- User
do you have a bootstrap 5.3 css reset
- Assistant