In this video, we look at how to build a form using an uncontrolled component. With an uncontrolled component, you use DOM elements to build the form.
- [Instructor] In this video we'll take a look…at one way to build a form using an uncontrolled component.…With an uncontrolled component…you'll use dom elements directly to build your form.…And then to capture input values we'll use refs.…So let's first get rid of this display stuff from before…instead we're going to render a component called…encouragement form, this is gonna encourage us…to keep programming, and, we'll say encouragement form…extends react component,…of course this is gonna render something…we will render a form.…
Now the form should have a label…and inside of that label we will add…the label text so we'll say send an encouraging message…and we'll add the input at this level as well.…So this will have a type of text,…and then we'll use the ref, we'll use input,…then we'll say this.input equals input.…
So this is gonna allow us to capture whatever the value is…that is entered into that field.…Now finally we want to add a button here,…our button is simply going to wrap around a submit…bit of text,…
- What's new in React 16
- Rendering arrays
- Controlled, uncontrolled, and compound components
- Using keyed fragments
- Working with new lifecycle methods
- React patterns
- Using the context API
- Checking for accessibility issues in your React code
Skill Level Advanced
1. What’s New in React
2. Advanced Components
3. Enhanced Components
4. React Patterns
5. React Accessibility
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.