score:0

Accepted answer

second update:

change your render code in react/index.js to

reactdom.render(
  <router history={browserhistory} >
    <route path="/" component={layout} >
      <indexroute component={index} ></indexroute>
      <route path="/exercise-1" name="exercise-1" component={exercise1} ></route>
      <route path="/exercise-2" name="exercise-2" component={exercise2} ></route>
      <route path="/exercise-3" name="exercise-3" component={exercise3} ></route>
      <route path="/exercise-4" name="exercise-4" component={exercise4} ></route>
      <route path="/exercise-5" name="exercise-5" component={exercise5} ></route>
      <route path="/exercise-6" name="exercise-6" component={exercise6} ></route>
      <route path="/:lessonname" name="lesson" component={lesson} ></route>
      <route path=":lessonname" name="lesson" component={lesson} ></route>
    </route>
  </router>
,app);

i..e the path starts with /

score:1

this one worked for me

nb

for react router

use <browserrouter> tag only once to enclose the whole of your application.

use this tag at the point of rendering.

for example

if you are using create-react-app .use this at your index.js file

reactdom.render(<browserrouter><app/></browserrouter>)


Related Query

More Query from same tag