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
Closed

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

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

Comments

@xgqfrms-GitHub
Copy link

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
Copy link
Contributor

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 as completed Mar 6, 2017
@xgqfrms-GitHub
Copy link
Author

Thanks a lot! 😄

@mech
Copy link

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
Copy link
Member

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
Copy link

@pshrmn, thanks !

@apeg1515
Copy link

Thanks Guys!!! @timdorr

@ClarenceC
Copy link

thank u ! @timdorr I have confused before.

@Mcebrera
Copy link

This helped alot, thanks!

@AndrewRayCode
Copy link
Contributor

@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants