Chris Clark
Chris Clark

Reputation: 528

Can I use the React Router < Router /> component with create-react-app?

If I wanted to use the React Router <Router /> component with create-react-app, am I able to do so without ejecting? I noticed that the React Router example page uses <Switch>, and it looks like <Router /> is contained within ReactDOM.render (which create-react-app places inside of the Index.JS entry point file).

Upvotes: 0

Views: 36

Answers (1)

Dylan Lee
Dylan Lee

Reputation: 118

You do not need to eject your create-react-app to you use React Router. Just install it alongside as an NPM package and import it just like normal. It will not conflict with any of the default React implementation.

Upvotes: 1

Related Questions