-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed
Description
https://github.com/ReactTraining/react-router
$ npm install --save react-router
// using an ES6 transpiler, like babel
import { Router, Route, Link } from 'react-router'
https://reacttraining.com/react-router/
$ npm install react-router-dom@next
# or
$ yarn add react-router-dom@next
import {
BrowserRouter as Router,
StaticRouter, // for server rendering
Route,
Link
// etc.
} from 'react-router-dom';
zhangtreefish, jimneath, AJamesPhillips, gazedash, lpan and 57 moresmartworld-dmxgqfrms-GitHub, tiennguyen-terralogic, ssuvorov, HernanGH and Raja-Sharmaxgqfrms-GitHub, ali-master, tiennguyen-terralogic, baruchvlz, Raja-Sharma and 1 morexgqfrms-GitHub, ali-master, tiennguyen-terralogic, Raja-Sharma, amypellegrini and 3 more
Activity
[-]what's the diff ?[/-][+]what's the diff between react-router-dom & react-router?[/+][-]what's the diff between react-router-dom & react-router?[/-][+]what's the diff between `react-router-dom` & `react-router`?[/+]pshrmn commentedon Mar 6, 2017
Your first link is to the master branch, which at this time is v3.
In v4,
react-router
exports the core components and functions.react-router-dom
exports DOM-aware components, like<Link>
(which renders an<a>
) and<BrowserRouter>
(which interacts with the browser'swindow.history
).react-router-dom
re-exports all ofreact-router
's exports, so you only need to import fromreact-router-dom
in your project.xgqfrms-GitHub commentedon Mar 7, 2017
Thanks a lot! 😄
mech commentedon Mar 14, 2017
So in the future, which is now where RR4 is released, which one shall we use for Web development only? Do we just do "yarn add react-router" will do?
timdorr commentedon Mar 14, 2017
You'll use the bindings for your environment. You will probably want to use react-router-dom for 99.9% of web dev.
MarcoMatta commentedon Mar 21, 2017
@pshrmn, thanks !
apeg1515 commentedon Mar 24, 2017
Thanks Guys!!! @timdorr
ClarenceC commentedon Jun 6, 2017
thank u ! @timdorr I have confused before.
Mcebrera commentedon Jul 16, 2017
This helped alot, thanks!
Adding documentation to react-router-dom and fixing repo link
AndrewRayCode commentedon Sep 19, 2017
@pshrmn repurposed your answer into documentation ^^^ I think this issue should be re-opened until the documentation is addressed, obviously lots of people have hit this.