Adding Query Parameters On Form Submission - React Router 4
The desired effect when submitting a form using React router 4 is to append the search query to the end of the URL. My current setup will send an API request on form submission, an
Solution 1:
You can dynamically push the queries to the url like
this.props.router.push({
pathname: '/yourRoute',
query: { someQuery: 'value' }
})
Connect your Component with witRouter
to be able to use the router prop
import { withRouter } from'react-router'
....
exportdefaultwithRouter(App);
Post a Comment for "Adding Query Parameters On Form Submission - React Router 4"