How come my route isn't matching with React Router 4? -


i have routes file works expected:

<route path="/app" render={({match}) => (     <switch>         <route exact path={`${match.url}/`} component={home} />         <route path={`${match.url}/error`} component={error} />     </switch> </route> 

but when try hard code routes, not work. example:

<route path="/app" render={({match}) => (     <switch>         <route exact path={`app/`} component={home} />         <route path={`app/error`} component={error} />     </switch> </route> 

of course hard coding not want, in case wanted this

<route path="/app">     <switch>         <route exact path="app/" component={home} />         <route path="app/error" component={error} />     </switch> </route> 

and create app using children of route , not render prop. doing wrong, or how can accomplish this?

react router v4 doesn't use nested routes.

<route path="/app"> match begins /app, don't think want.

this should enough want:

<switch>   <route exact path={`/app/error`} component={error} />   <route path={`/app`} component={home} /> </switch> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -