I just started learning REACT, but I have a problem with React-route, problem is children use parent CSS, but how can we use fresh new CSS on child? Not anything get from parent CSS?
I have a file structure like this:
---src
-----index.js
-----login.js
-----home.js
-----style.css
I imported 'style.css' in login.js but it continute to use in login.js, I want to design complete different style in home.js, so I created home.css and put some element in there but it not cast over the style.css.
Here is some of my code
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Link, BrowserRouter as Router } from 'react-router-dom'
import Login from './login.js'
import New from './home.js'
const routing = (
<Router>
<div>
<Route exact path="/" component={Login} />
<Route path="/new" component={New} />
</div>
</Router>
);
ReactDOM.render(routing, document.getElementById('root'));
my login.js
problem is style.css have a body element that I can't change, if use a div in login.js and put a className it have background but have border, not full page.So I load localhost:3000/new it still have same background, I want it totally white, like fresh page or have dirrent CSS, not use parent.
So my question is:
How to make each child in route have unique style, not have it from it parent? or how can I do that with React?