Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Router 4 Basics Getting Started with React Router Installing React Router and Declaring Routes

React router cannot get /** while trying to reload page in a nested route

I'm using react-router-dom, when navigating via links the route is working as it should, but when the page is refreshed while in a nested route it throws Cannot GET /***(what ever page it is in).

But as per this video demonstrated if you type a nested url it works?

Justin McKenzie
Justin McKenzie
6,724 Points

add this to your webpack.config.js file:

devServer: { historyApiFallback: true }

After trying to figure this out for the past 2 hours, lo and behold the question and solution was posted within this video discussion. Thanks Sharavanan Subramanian for posting, and Justin McKenzie for your response.