-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
?_k=*
in the query string
#1967
Comments
Please see here. |
My apologies. I also found more info on in here: |
@gaearon, could you elaborate on how your link relate to this issue? I'm not using rackt in my app... |
@DanielSundberg this link is to History documentation which is used by React Router. Rackt is an organization under which we keep React Router, History and many more open source projects... |
Ok thanks for the clarification. Perhaps there should be something about this in the upgrade guide? (https://github.com/rackt/react-router/blob/master/UPGRADE_GUIDE.md). We haven't used the history feature of react-router before and I was very confused when I saw that this was added to the url. |
it's already here I don't see the point of repeating stuff like this everywhere. Upgrade guide says about the use of the new History, and I think that's enough. Added |
I don't think that adding a new parameter to the url is a small detail. And I would not expect users of a component to read through all documentation when upgrading. I did google this and I came across this issue before the documentation link in the result list. |
@DanielSundberg if it brings so much confusion and you don't mind please send the PR for the change in the Upgrade Guide |
It looks like it's opt-outable here but this was hard to find and involves another package. For what it's worth, our team was evaluating upgrading to React 0.14.0 and React Router 1.0.0 but has now decided to hold off mainly because of this - our app doesn't have any state data we need persisted and so this feature has no value for us. Unfortunately for us, adding extra dependencies (history/lib/createHashHistory) is a somewhat arduous process. I'll try and send a docs PR for the upgrade guide. |
@johnnyreilly Are you saying that adding three extra lines of code is an arduous process? |
I don't understand why when I am using HTML5 pushState it can work without extra In other words why |
HTML5 history API lets you attach state to history entries, while using hash history doesn't. That query key is to let you use things like |
old browser is not a concern for me. Is it possible to opt it out from React router? |
Thanks for your question! We want to make sure that the GitHub issue tracker remains the best place to track bug reports and feature requests that affect the development of React Router. Questions like yours deserve a purpose-built Q&A forum. Would you like to post this question to Stack Overflow with the tag #react-router? https://stackoverflow.com/questions/ask?tags=react-router. We also have an active and helpful React Router community on Reactiflux, which is a great place to get fast help with React Router and with the rest of the React ecosystem. You can join at https://discord.gg/0ZcbPKXt5bYaNQ46. |
If you're not concerned about old browsers then use browser history, not
|
On browserHistory on refresh page I am getting Cannot GET /badge |
Some of our front end applications can't be served with * so if I don't push a hash in the url I will get a Cannot GET /login or something similar. Please let us remove the _k from the hashHistory |
There's an example of how to remove the _k in the documentation: https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#using-custom-histories import { Router, useRouterHistory } from 'react-router'
import { createHashHistory } from 'history'
// useRouterHistory creates a composable higher-order function
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false })
<Router history={appHistory}/> |
Without ES6, I have implemented this code:
Refresh the browser without the hash code. |
I came across this thread after searching for the query keys, looks like a the links posted by @gaearon and @alexreardon seem to be broken. Would be useful for people trying to understand why it was added. |
You can find the explanation here Best, |
How about expose this option to react-router user? |
Not sure i understand your question |
Sorry for my English >.< var Routes = (
<Router history={appHistory} queryKey=false>
<Route path="/" component={Base}>
</Route>
</Router>
); |
That wouldn't make sense as only hashHistory uses query key. Best, |
Indeed. 😓 I just don't want to touch history again since I'm using [email protected] |
Well, seems we still need import { Router, useRouterHistory } from 'react-router'
import { createHashHistory } from 'history'
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false })
<Router history={appHistory}/> |
@yard2010 thanks for your feedback. Let me answer your main question first:
because the question has been answered and then was closed.
The project has been very active in those couple months, we changed the structure of the project and that's the reason most of the links in the issues are "dead". Although if you use Github search feature it is very easy to find what you look for.
We know about it and trying to fix it as much as we can. Our main focus was getting the Router 2.0 out. We are going to work more on the docs in near future, please see: #2933
That is great to hear, just send the PRs with suggested changes we appreciate any help. |
Thank you @knowbody , thank you again. |
This following lines solved my problem . Thanks ! @gpbmike import { Router, useRouterHistory } from 'react-router'
import { createHashHistory } from 'history'
// useRouterHistory creates a composable higher-order function
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false })
<Router history={appHistory}/> |
If you're using More info here: https://github.com/reactjs/react-router-tutorial/tree/master/lessons/10-clean-urls |
@ixrock the problem with |
@abdelav if you don't use node environment at all that's true. Just vanilla js/html/css? You don't need express server otherwise, just webpack-dev-server |
Since some of the urls in the first posts of the thread are invalid, here some reference to the documentation that explains it. However I am still not clear what |
With History deprecated, there is another way of using hashHistory without the "?_k=*" Or the idea is not supporting anymore? |
History isn't deprecated? |
Using this got rid of the query string But now I can't seem to use this.context.router.push anymore... |
The above no longer works for 2.4.1, resulting in a blank page on refresh with the following error;
Which is odd as I am not using location state regardless. Any suggestions on course of action? http://stackoverflow.com/questions/37591063/react-router-v2-4-querykey-false-no-longer-works |
Updated links:
Sample:
|
Hey @basarat - guess what? I'm back working on a React project.... Yay the uni-directional data flow! 😄 🌷 |
I finally found what I want answers! Thanks ! |
The doc link for opt out has deleted the opt out section. I've asked for clarification there remix-run/history#337 🌹 |
You don't need to explicitly opt out any more. Just don't use location state. |
@taion since which version. I'm on https://github.com/reactjs/react-router/blob/master/CHANGES.md#v241 and it still adds |
In fact I just went to latest https://github.com/reactjs/react-router/blob/master/CHANGES.md#v261 and I still get |
It was removed in history v3. If you're using history v2 (e.g. with React Router v2), then consult the history v2 docs on the v2 branch. |
@taion thanks! 🌹 |
Stupid question for v3: What would be the most convenient to get |
I thought react router didn't work with history v3 yet?
|
I use EDIT:
|
Updating "react-router" to "^3.0.0-alpha.3" solved my problem. Thanks @taion |
@donaldpipowitch @taion @basarat Do I need to install react-router and add
Because it doesnt actually work, I'm having a blank page, here's my index.js:
And anyway, why do I have to enable routes just to disable this annoying URL phrase? @guicheffer Have you just npm installed [email protected]? Because the react module itself uses an older version, how did you force it to use this more recent router version? |
After updating to the latest version I am getting
?_k=*
(eg?_k=umhx1s
) added to end of my urls. A few questions:The text was updated successfully, but these errors were encountered: