What is the difference between react-router and react-router-dom?

Posted in Uncategorized

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

In short, if you are building a web app in React and you want to use React Router, just install “react-router-dom”. If you are building React Native, install “react-router-native”.

In React Router v4, the React Router was broken into two: react-router and react-router-dom. react-router is the core. And react-router-dom is the core plus the React Router elements such as <BrowserRouter> and <NavLink> etc.

Since react-router-dom is like a super-set of react-router, you only need to import react-router-dom.