how do i append multiple query strings? i cant find an answer for react router v4 anywhere.
right now i only get www.example.com/products?sort=newest or www.example.com/products?page=1
and what i am trying to get is something like www.example.com/products?sort=newest&page=1
Thank you in advance
class CategoriesChild extends React.Component {
componentWillMount() {
const values = queryString.parse(this.props.location.search)
this.props.startSetProductsCategoryChildren(this.props.match.params.category, values.page, values.sort)
}
renderProducts () {
const { props } = this;
return (
<h2>{this.props.categoryName}</h2>
<p>You can sort and filter on the section to the right.</p>
</div>
<div className="profile-options-content">
{
this.props.products.length === 0 ?
<p style={{textAlign: 'center', opacity: '0.5', marginTop: '50px'}}><i>There is no products in this category just yet!</i></p> :
this.props.products.map((product) => {
return <ProductListItemMore key={product._id} {...product} />
})
}
<div className="pagination" >
<div className="pagination-bar">
{
this.props.products.length === 0 ?
'' :
Array(this.props.pages).fill(0).map((e,i) => {
return <Link to={{
pathname: `${this.props.match.url}`,
search: `&page=${i+1}`
}} key={i+1} >{i+1}</Link>
})
}
</div>
</div>
</div>
</div>
<div className="profile-settings-container">
<div className="profile-settings-container-sort">
<h3>Sort</h3>
<Link to={{
pathname: `${this.props.match.url}`,
search: '?sort=newest'
}} className="profile-link-button">Newest</Link>
<Link to={{
pathname: `${this.props.match.url}`,
search: '?sort=oldest'
}} className="profile-link-button">Oldest</Link>
<Link to={{
pathname: `${this.props.match.url}`,
search: '?sort=price-high'
}} className="profile-link-button">Highest Price</Link>
<Link to={{
pathname: `${this.props.match.url}`,
search: '?sort=price-low'
}} className="profile-link-button">Lowest Price</Link>
</div>
</div>
)
}
post mostly code... i dont know what more to write... i added all the details...