Users redirected to my app after login (server on java), and they have url, which looks like this http://10.8.0.29:8083/html/?locale=RU&token=1c5c71f2-dcda-4a51-8cf6-f8
In React-Router 4.3 (not sure about earlier versions), if you have a
just above, something like this should work: (this is in Typescript)
Route({ path: ..., render: (props) => function() {
Redirect({ ...,
to: { pathname: ... search: props.location.search, ... }})
});
Explanation: You use the render: (props) => ....
proprety of the
tag, instead of component: ...
, because render
gives you props
, so then inside the
you can use props.location.search
and in that way access the current query params, and reuse in the redirect.
If there's no
above, maybe you cannot. I just asked here: How preserve query string and hash fragment, in React-Router 4