Skip to content

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

@xgqfrms-GitHub

Description

@xgqfrms-GitHub

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';

Activity

changed the title [-]what's the diff ?[/-] [+]what's the diff between react-router-dom & react-router?[/+] on Mar 6, 2017
changed the title [-]what's the diff between react-router-dom & react-router?[/-] [+]what's the diff between `react-router-dom` & `react-router`?[/+] on Mar 6, 2017
pshrmn

pshrmn commented on Mar 6, 2017

@pshrmn
Contributor

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.

xgqfrms-GitHub

xgqfrms-GitHub commented on Mar 7, 2017

@xgqfrms-GitHub
Author

Thanks a lot! 😄

mech

mech commented on Mar 14, 2017

@mech

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

timdorr commented on Mar 14, 2017

@timdorr
Member

You'll use the bindings for your environment. You will probably want to use react-router-dom for 99.9% of web dev.

MarcoMatta

MarcoMatta commented on Mar 21, 2017

@MarcoMatta

@pshrmn, thanks !

apeg1515

apeg1515 commented on Mar 24, 2017

@apeg1515

Thanks Guys!!! @timdorr

ClarenceC

ClarenceC commented on Jun 6, 2017

@ClarenceC

thank u ! @timdorr I have confused before.

Mcebrera

Mcebrera commented on Jul 16, 2017

@Mcebrera

This helped alot, thanks!

AndrewRayCode

AndrewRayCode commented on Sep 19, 2017

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

deleted a comment from japrogramer on Nov 27, 2017
deleted a comment from arunrajnov3 on Feb 13, 2018
locked and limited conversation to collaborators on Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mech@timdorr@AndrewRayCode@pshrmn@MarcoMatta

        Issue actions

          what's the diff between `react-router-dom` & `react-router`? · Issue #4648 · remix-run/react-router