Join Eve Porcello for an in-depth discussion in this video Using refs, part of Learning React.js (2016).
- [Instructor] When creating components in React,…there are times when we might want to check in…with UIElements to access their values.…For example, in our note component here,…if I edit it, I change some text,…we notice that as soon as I click Save,…nothing happens to that text.…So, if I want to grab that value,…I can access it by using a reference.…The process of setting this up is pretty simple.…So, here in our index.html file,…I'm gonna go ahead and add a new reference…to this text area.…
So here on line 29, I'll say ref equals,…and we'll just use a string reference here,…new text.…Cool!…Next I'm going to go to my save method…and I'm going to create a variable called val,…and I'm going to use this dot refs…dot newtext dot value.…And just to make sure that this is working okay,…let's add a little alert here and we'll say,…later we will save this value.…
And then we'll add that to value.…So, I'm gonna check this out in my browser…and see how this works.…So refreshing this, I'll click Edit,…and I'll say New Value, and click Save,…
- What is React.js?
- Introducing JSX
- Creating a React component
- Handling events
- Using state
- Working with PropTypes
- Adding child elements
- Mounting and updating components
- Creating a React.js app
Skill Level Beginner
Building a Web Interface with React.jswith Ray Villalobos1h 21m Intermediate
1. What Is React.js?
2. Getting Started
3. React Components
4. Props and State
5. Enhancing Components
6. Creating an App
Using create-react-app4m 38s
Next steps1m 4s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.