Skip to content Skip to sidebar Skip to footer

React Router Did Not Match Any Route

i trying to make some basic examples with react-router but it just doesn't works. The code and the idea are simples: import React, { Component } from 'react'; import { Router, Rout

Solution 1:

I think I got your mistake, your route doesn't actually specify a path.you need to put slash for every path like this:-

render() {
    return (
      <Routerhistory={browserHistory }><Routepath='/'component={App } ><IndexRoutecomponent={Repos } /><Routepath='/about'component={About } /></Route></Router>
    );
  }

Solution 2:

try refactoring your app.js as follows:

exportdefaultclassAppextendsComponent {
    render() {
        return (<div> (this.props.children} </div>):
    }
}

you need to pass down the routes to your main app component.

Post a Comment for "React Router Did Not Match Any Route"