Skip to content

React Router Not Working #1807

Closed
Closed
@tamaccount

Description

@tamaccount

I am having trouble using React Router to create another static page within my app.

Here is what my render method looks like:

ReactDOM.render(
 <Router history={hashHistory}>
  <Route path="/" component={Home}>
     <Route path="material" component={Material}/>
   </Route>
 </Router>,
 document.getElementById('root')
);

When I try to visit localhost:8080/material, the url redirects to localhost:8080/material#/ and I the page just loads Home instead of Material. There is no way for me to access my Material Component.

The same error occurs when I reconfigure the render method to look like this:

ReactDOM.render(
 <Router history={hashHistory}>
  <Route path="/" component={Home}/>
  <Route path="/material" component={Material}/>
 </Router>,
 document.getElementById('root')
);

What do I have to do to get access to different routes?
edit: forgot question mark

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions