I am currently building an e-commerce website and I have questions about URL query string.
In the Shop page, there are lists of fetched products data and filter options. Users can filter products by their conditions(array), sort by, categories(array), and price range.
Let's say I check marked some of the conditions and categories to filter out, and I will be sending query to database, so I can received filtered result. Then, I wanted to share my result to other people. In this case I need to store filter data in the URL so other people can see same results as I am seeing. I can achieve that by using query string.
Here are my questions:
- Am I understanding the use case of query string correctly?
- Is there other modern way to handle this type of situation? (I am using React)
- Is it okay to use an array as a query string? If so, what will be the practical way? JSON.stringify?? (string kinda looks ugly)