From the course: React for Web Designers
Unlock this course with a free trial
Join today to access over 22,500 courses taught by industry experts.
Solution: Better usability and animation - React.js Tutorial
From the course: React for Web Designers
Solution: Better usability and animation
- Let's take a look at one possible solution to this usability and animation challenge. So we can see there's a 'Reset' button here. If I try setting a few of these filters, I have some different animations happening, and if I click 'Reset', I have all the people once again. All right, let's look at the code. So first we'll take a look at the 'Reset' button implementation. That's going to be down here in 'Filters'. So I'll scroll down first to the elements that create the 'Reset' button. I just used another one of these divs with the class "group", and put a 'Reset' button in there. And it has an event handler 'onClick', which is calling a function called 'resetFilters'. A function which is defined up here. And this is just calling 'props.updateFormState' for each of the elements of state that need to be updated. Now any time that you start writing the same thing more than once, that's an opportunity to make some changes, which is something that you could do by changing how this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Use the mockup, make a plan6m 9s
-
Scaffold initial components5m 58s
-
Functional components6m 37s
-
Build the filters form5m 41s
-
Forms in React: Controlled or not2m 53s
-
Wire up the filters form10m 57s
-
Respond to filter form updates5m 33s
-
Animating with ReactTransitionGroup8m 21s
-
Challenge: Better usability and animation3m 11s
-
Solution: Better usability and animation5m
-
-
-