From the course: React for Web Designers
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Wire up the filters form - React.js Tutorial
From the course: React for Web Designers
Wire up the filters form
up the filter form fields as controlled elements, that update some new state variables tracking their contents. So as of now, I can type in these and nothing happens. We're going to change these so they are controlled. So first, we know we're going to need to track some new state. We're going to need to track the currently typed in name, the currently selected title and whether We'll add a key called current name which will start out empty. Likewise the current title, also empty. And we'll use isIntern to track whether that checkbox is checked, and that will start as false. So these are the pieces of state we have at the Directory level, and we'll pass these into the filters as props. We're keeping the state here at the Directory level because these are all going to influence each other. Seems like the right place for now. So we'll pass these all in currentName equals this.state.currentName, currentTitle is this.state.currentTitle. We'll also pass in isIntern this.state.isIntern…
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
-
-
-
-
-
(Locked)
Use the mockup, make a plan6m 9s
-
(Locked)
Scaffold initial components5m 58s
-
(Locked)
Functional components6m 37s
-
(Locked)
Build the filters form5m 41s
-
(Locked)
Forms in React: Controlled or not2m 53s
-
(Locked)
Wire up the filters form10m 57s
-
(Locked)
Respond to filter form updates5m 33s
-
(Locked)
Animating with ReactTransitionGroup8m 21s
-
(Locked)
Challenge: Better usability and animation3m 11s
-
(Locked)
Solution: Better usability and animation5m
-
(Locked)
-
-