I had the same error popping up while using <Switch /> inside <Router /> .

Moving the <Switch /> directly above my <Route /> routes fixed it for me. No more warnings! Your post put me in the right direction, so thank you!

My end result:

<Router>
<Switch>
<Route exact path="/" component={Component1} {...props} />
<Route path="/userprofile" render={() => <UserComponent {...props.userProfile} />} />
</Switch>
</Router>

Thanks!

Organic, fair-sourced DevOps and Full-Stack things. This is a BYOB Establishment — Bring Your Own hipster Beard.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store