Skip to content

Pass basename to StaticRouter for createHref #3843

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

Closed
wants to merge 1 commit into from

Conversation

chentsulin
Copy link
Contributor

Try fix #3839

router.createHref should handle basename

@timdorr
Copy link
Member

timdorr commented Sep 14, 2016

This isn't entirely correct. The basename needs to be passed to the underlying history instance, which has support for it internally. We shouldn't be stitching together URLs in this project.

@timdorr
Copy link
Member

timdorr commented Sep 14, 2016

Nevermind, I'm even new to react-history. You can pass the basename prop to BrowserRouter.

@timdorr timdorr closed this Sep 14, 2016
@chentsulin
Copy link
Contributor Author

chentsulin commented Sep 14, 2016

@timdorr

It seems that history is no longer responsible for creating hrefs. See remix-run/history#365 (comment)

And Link component just use router.createHref to create hrefs, so miss the basename: https://github.com/ReactTraining/react-router/blob/v4/modules/Link.js#L91

@timdorr timdorr mentioned this pull request Sep 15, 2016
@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

Successfully merging this pull request may close these issues.

2 participants