I need to change the address in browser when the user submits the search query, based on that query (something familiar to what Google does). When I do this, the address changes properly, but it redirects me to my 404 route. And when I manually input text to the address bar, I can see the proper page.
This is a part of my routes:
...
<Route path="some-address" component={MyComponent}>
<Route path=":query" />
</Route>
...
Here's a simplified version of my component:
@withRouter
@connect(...)
export default class MyComponent extends Component {
...
render() {
return (
<form onSubmit={(e) => {
e.preventDefault();
this.props.router.push(e.target.myInput.value)}}
>
<input name="myInput" />
</form>
}
}
React Router is 2.6.1 version.