I have a back-end built using Django Rest Framework and front-end served using React. I'm having a Filter component and Sort By component. I receive the products
data as a json from back-end. I want to be able to filter by few fields such as category, brand, price etc
and sort based on fields as well like ascending category, descending price etc
. Basically i'd want my url to look like this
/products?category=a&category=b&brand=c&sort=category_desc
My question is
- What is the best way to filter data i.e should i send data to back-end to filter using
django-filters
or filter using a javascriptarray.filter()
? - Should i sort using
django-filter's
OrderFilter
or customjavascript's
array.sort()
- How to synchronise the query params in front-end with both filters and sortby conditions.
I'm new to this, so if there is any blog post or document i can go through, that would be really helpful too along with your inputs. Thanks in advance!
Via Active questions tagged javascript - Stack Overflow https://ift.tt/fqZh9d3
Comments
Post a Comment