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

v4-beta About location handle #4479

Closed
zombieJ opened this issue Feb 7, 2017 · 1 comment
Closed

v4-beta About location handle #4479

zombieJ opened this issue Feb 7, 2017 · 1 comment

Comments

@zombieJ
Copy link

zombieJ commented Feb 7, 2017

Ref: #4410

For server side render: https://github.com/ReactTraining/react-router/blob/v4/packages/react-router/modules/StaticRouter.js#L115

history always be replaced by inner history. So I guess it may provide some props with each Router to make it easier for location query self handle.

in addition, how do I handle Redirect.to, Link.to && router.push when I want to use query instead of connecting the search string?

@pshrmn
Copy link
Contributor

pshrmn commented Feb 7, 2017

You should be stringifying your query object in whatever component is rendering your <Redirect>/<Link>.

import { stringify } from 'qs'

const MyComponent = () => (
  <div>
    <Link to={{ pathname: '/some-place', search: '?' + stringify({ a: 'b', c: true }) }}>Go Here</Link>
  </div>
)

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