In this video, learn how to use the useEffect hook, which allows React code to take effect on components at various times after the component has rendered. You will use the hook to retrieve messages from your API.
- [Instructor] In this video, … we're going to retrieve data from our API … using another React hook called useEffect … and render the status messages on the page. … Over here in our code, we're going to go down to … the status message list component. … So I'm going to use … Shift command + O, … I can arrow down to status message list, … and I have my stub statuses collapsed down here … to make it a little easier to read. … So what we're going to do … is load the status messages using an http get … from our little API. … The URL for that as we currently have it configured … is going to be something like … localhost/reactjs/status_api/get.php. … I can select that, copy it, … I'll just check this over in my browser. … There we go. … That doesn't load stuff. … So I'm going to write a helper function to … do the message retrieval. … We'll call it retrieve status messages. … And for this, we'll use that Axios library … that we brought in, … which has a get method. … Now all we need to pass to that in the URL of interest. …
- Installing React on an existing site
- Thinking about a design in terms of components
- Creating fully-featured function components using Hooks
- Storing and retrieving data from an external RESTful API
- Employing third-party components for CSS animation
- Using conditional rendering
Skill Level Intermediate
Essentials of CSS for React Developerswith Eric Greene53m 31s Beginner
React.js Essential Training (2018)with Eve Porcello1h 25m Intermediate
Using the exercise files1m 2s
1. Introducing React
2. First Project: Customizer
3. Second Project: Directory Browser
4. Third Project: Status Updater
- 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.