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

react-router-* should provide as is absolutely all not changed inherited functions #5164

Closed
a-x- opened this issue May 24, 2017 · 1 comment

Comments

@a-x-
Copy link

a-x- commented May 24, 2017

// Excuse my beginner's English

e.g. react-router-dom does not re-exports browserHistory now.

also, instead of creating wrappers for every react-router function it'll be the better keep only index.js with re-exports (better for changed method readability. e.g. I want to look sources of react-router-dom for added/changed methods, I have to open all the modules in the react-router-dom/modules/index.js
now ).

e.g. wrapper to delete:
MemoryRouter.js

export { MemoryRouter as default } from 'react-router'

e.g. how to rewrite re-exports:
react-router-dom/modules/index.js

// ...
export MemoryRouter from '../react-router/MemoryRouter'
// ...

thank you

@pshrmn
Copy link
Contributor

pshrmn commented May 24, 2017

  1. browserHistory is not exported because it no longer exists. The <BrowserRouter> component creates a history object for you. If you need a custom history object, you have to create it yourself and pass it to a <Router>.

  2. The separate files have something to do with enabling tree shaking (see Add ES build to react-router and react-router-dom (#4425) #4432 and the issue it links to). I'm not familiar enough with tree shaking to add any more information on why it was necessary.

@pshrmn pshrmn closed this as completed May 24, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
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

2 participants