From the course: Building React and Django Apps

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Filtering with React

Filtering with React

From the course: Building React and Django Apps

Start my 1-month free trial

Filtering with React

- [Instructor] On the React front end our filter component will keep track of the price minimum and maximum and search text. We're going to store that in the state of the component. We implement an update field method to make updating filters simpler. And then when we actually apply the filter we're actually calling the onFilterUpdate callback and passing in the state of the filters. Notice that the component is unaware of any network calls that need to be made because those will be handled in the onFilterUpdate callback. Now let's update the render method and display the fields. First we're going to be binding all of the fields with the updateFilter method. We do the same for the maximum price. And we're going to do the same for the search field. We're also going to bind the apply filter callback. Let's extract the current values for the filters from the state. And then we can start displaying things. We've got the…

Contents