Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

[Question] How to pass query string to a NavLink and a navigateAction #74

Open
bchelli opened this issue Aug 1, 2015 · 2 comments
Open

Comments

@bchelli
Copy link

bchelli commented Aug 1, 2015

Hi Guys,

First of all, awesome job here, this really helped me kick start my React project.

I have an issue though, I would like to be able to pass query string parameters to:

  • a NavLink
    <NavLink routeName="login" queryParams={{redirect:'/some/other/url'}}>Login</NavLink>
  • a navigateAction
    context.executeAction(navigateAction, {
        type:   'click',
        url:    '/login/url',
        query: {
            redirect:'/some/other/url'
        }
    }, done);

I guess the way I'm trying to do this is not the fluxible way, so could you point me in the right direction.

Should I use the navParams to pass the query string values to the route and therefore define optional query string parameters in the path of the route (as asked in the issue #42)?

var routes = {
    login: {
        method:  'GET',
        path:    '/login/url?redirect=:redirect',
        handler: LoginPageHandler
    }
};

Thanks,
Ben

@geekyme
Copy link

geekyme commented Aug 6, 2015

you would have to pass the query params in the href eg. href=/login/url?redirect=%20/home

@bchelli
Copy link
Author

bchelli commented Aug 6, 2015

Hi @geekyme,

First of all, thanks for the help.

Getting back to the issue, I think I have omitted an important point in my previous message:

I would like to avoid as much as possible the utilization of href and more generally any type of hard coded URL. This should prevent me from having to go through the entire application's source-code and check if / how to update URLs when a change occurs in the pattern of one URL.

Let me know if this makes sense.

Thanks,
Ben

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants