Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what's the diff between `react-router-dom` & `react-router`? #4648

Closed
xgqfrms-GitHub opened this issue Mar 6, 2017 · 9 comments

Comments

@xgqfrms-GitHub
Copy link

@xgqfrms-GitHub xgqfrms-GitHub commented Mar 6, 2017

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';
@xgqfrms-GitHub xgqfrms-GitHub changed the title what's the diff ? what's the diff between react-router-dom & react-router? Mar 6, 2017
@xgqfrms-GitHub xgqfrms-GitHub changed the title what's the diff between react-router-dom & react-router? what's the diff between `react-router-dom` & `react-router`? Mar 6, 2017
@pshrmn

This comment has been minimized.

Copy link
Collaborator

@pshrmn pshrmn commented 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's window.history ).

react-router-dom re-exports all of react-router's exports, so you only need to import from react-router-dom in your project.

@pshrmn pshrmn closed this Mar 6, 2017
@xgqfrms-GitHub

This comment has been minimized.

Copy link
Author

@xgqfrms-GitHub xgqfrms-GitHub commented Mar 7, 2017

Thanks a lot! 😄

@mech

This comment has been minimized.

Copy link

@mech mech commented 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

This comment has been minimized.

Copy link
Collaborator

@timdorr timdorr commented 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

This comment has been minimized.

Copy link

@MarcoMatta MarcoMatta commented Mar 21, 2017

@pshrmn, thanks !

@apeg1515

This comment has been minimized.

Copy link

@apeg1515 apeg1515 commented Mar 24, 2017

Thanks Guys!!! @timdorr

@ClarenceC

This comment has been minimized.

Copy link

@ClarenceC ClarenceC commented Jun 6, 2017

thank u ! @timdorr I have confused before.

@Mcebrera

This comment has been minimized.

Copy link

@Mcebrera Mcebrera commented Jul 16, 2017

This helped alot, thanks!

@AndrewRayCode

This comment has been minimized.

Copy link
Contributor

@AndrewRayCode AndrewRayCode commented 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
9 participants
You can’t perform that action at this time.