I've the following code base.
<Router>
<Grid className='full-height' fluid>
<Row>
<Col xs={6} xsOffset={6} className='top-line' />
</Row>
<Row>
<NavBar />
</Row>
<Row>
<div className='content-wrapper'>
<Switch>
<Route exact path='/' component={Container} />
<Route path='/login' component={Login} />
<Route path='/register' component={Register} />
<Route path='/dashboard' component={Dashboard} />
<Route exact path='/packages' component={Packages} />
<Route path='*' component={NotFound} />
</Switch>
</div>
</Row>
</Grid>
</Router>
I would like to add a class to the Grid
component based on the route path. Basically what I want is to add a specific class when on path='/'
so I can custom style home page. Since the container
component is residing inside the content-wrapper
I couldn't style it to the way I want.
How can I add a custom class based on the route path in react router?