Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react router redirect with query params

import { withRouter } from 'react-router-dom';

class SearchComponent {

    // Component Code goes here

    onSubmit(){
        let queryString = "q=" + this.state.q;
        this.props.history.push(`/search/hotels?${queryString}`);
    }
}

export default withRouter(SearchComponent)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #react #router #redirect #query #params
ADD COMMENT
Topic
Name
5+6 =