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!