skip to Main Content

How to change the path when NavLink is active – Reactjs

<NavLink className={({ isActive }) => (isActive ? "isActive" : "isNotActive")} to={"artist/" + currentMotive.artist.slug.current} key={currentMotive.artist.slug.current}> {currentMotive.artist.name} </NavLink> How can I change the attribute to in the same way as className? Like: to={({ isActive }) => isActive ? "/motive/" + currentMotive.slug.current :…

VIEW QUESTION

Conditional Route immediately executes inside Switch – Reactjs

I have a Switch with a series of Route elements in my main container: AppContainer.js <Switch> <Route exact path={`/app/:slug/`}> <Redirect to={`/app/${slug}/home`} /> </Route> <ProtectedRoute path='/app/:slug/userAdmin/' component={UserAdminContainer} message={'This page is read-only'} /> [snip] <Route path='/app/:slug/protectedRoute/' render={(props) => ( <ReadOnlyError message={props.message} />…

VIEW QUESTION
Back To Top
Search