React Router with React 16.6 Suspense "Invalid prop `component` of type `object` supplied to `Route`, expected `function`." React Router with React 16.6 Suspense "Invalid prop `component` of type `object` supplied to `Route`, expected `function`." reactjs reactjs

React Router with React 16.6 Suspense "Invalid prop `component` of type `object` supplied to `Route`, expected `function`."


Try using render prop instead of component

<Route path="/" render={()=> <Prime />} exact /><Route path="/demo" render={()=> <Demo />} />


This will be fixed in react-router-dom version 4.4+ as this issue suggests

You can wait for the final release or if you don't want to change your code today, you can install the beta version now by yarn add react-router-dom@next


I know this answer do not respond the original question, but as I have experienced a similar issue, maybe my solution will help another people.

My Error:

Failed prop type: Invalid prop `component` of type `object` supplied to "link", expected function.

Alike the accepted answer, this could be fixed with:

<Link to={'/admin'} title={'Log In'} component={props => <Button {...props} />} />