Here is my App.js component so far:
function App() {
return (
<div className="App">
<Router>
<NavBar />
<Switch>
<Route exact path='/' component={HomepageLayout} />
<Route exact path='/post/:id' component={Post}/>
</Switch>
</Router>
</div>
);
}
I need to render the CSS value of a class based on the route that is being rendered. When the HomepageLayout component is rendered, I need the following:
styles.css
.ui.inverted.vertical.center.aligned.segment{
position: fixed;
left: 0px;
top: 0px;
width: 100%;
z-index: 2;
}
Then, I need to change the values for this target when the Post component is rendered so that the styles are basically removed:
styles.css
.ui.inverted.vertical.center.aligned.segment{
position: none;
left: none;
top: none;
width: none;
z-index: none;
}
Is there a way to change the styles for a particular CSS class tag based on the route? I have seen examples using , but is there a way to do this with / ?