score:0

Accepted answer

well, i fixed the problem, it was in the exact declaration of the home route, i was expecting exactly the home route to render the content.

yes, is a very stupid detail but it matters a lot:

    <switch>
      <route path="/" exact component={login} />
      <protectedroute path="/home" exact component={home} />
    </switch>

the above code will not render anything else that the component of /home, and the code below (the inclusive route), will render everything:

    <switch>
      <route path="/" exact component={login} />
      <protectedroute path="/home" component={home} />
    </switch>

it was that simple, i'm sorry for the question but little details like this are difficult to see if it is your first time with new tools.

score:1

in app

 <switch>
    <protectedroute path="/home" exact render={ () => <home/>} />
    <route path="/" exact render={ () => <login/>} />
  </switch>

in home

<switch>
        <route path={`${match.path}`} exact render={ () => <dashboard/>} />
        <route path={`${match.path}/videos`} render={ () => <dashboard/>} />
        <route path={`${match.path}/notas`} render={() => <dashboard/>} />
        <redirect to={`${match.url}`} />
 </switch>

need to use the render prop.


Related Query

More Query from same tag