Chapters (57)
- 0:00Introduction (what are we building?), tech stack talk
- 1:50Using create-react-app as our base
- 3:30Stripping out the files & content that we do not need
- 5:00Refactoring to named exports
- 8:35Modifying our .env file
- 9:15Scaffolding our application
- 10:15Looking at the Hacker News Api
- 11:50Looking at all the news article Ids
- 12:58Adding Axios using Yarn
- 13:00Creating our hnApi.js service file
- 15:07Adding the ability to get all story Ids from HN Api
- 17:14Starting work on App.js
- 22:30Adding useEffect to App.js to show all story Ids
- 30:00Explaining how useEffect works
- 36:00Creating our StoriesContainer.js container/component
- 37:50Adding the ability to get stories from HN Api
- 39:50Demonstrating the results that we receive from the HN Api
- 41:30Creating our Story.js component file
- 43:15Adding our Story component to the StoriesContainer component
- 44:10Adding storyId as a prop to the Story.js component
- 46:40Adding state to our Story.js component
- 47:10Using useEffect to get a story in our Story.js component
- 47:40Adding validation when getting stories
- 49:00Dumping our stories onto the page
- 49:55Building out the Story.js component with real data
- 53:20Adding a selector for the story fields
- 56:00Adding styled components
- 57:00Building out our StoryStyles.js file using styled components
- 59:00Adding a title to StoriesContainer.js
- 1:00:00Adding a StoryWrapper to our Story.js component
- 1:01:50More work on styling
- 1:02:30Adding styling for StoryMeta
- 1:03:55Adding styling for StoryMetaElements & styled component props
- 1:04:55Adding our styled components to our Story.js component
- 1:11:30Adding StoriesContainerStyles for more styling on the container
- 1:12:05Looking at adding global styles (createGlobalStyle)
- 1:13:00Adding our container styles to StoriesContainer.js
- 1:14:55Brief look at the React profiler
- 1:16:00Quick run through as to what we have built so far
- 1:18:10Making our time display properly using mapTime.js
- 1:22:00Adding InfiniteScroll to our application (custom hook)
- 1:22:40Constants to be used by InfiniteScroll for per page items
- 1:39:05Adding debounce functionality for scrolling
- 1:42:00Adding a fixture folder with fixtures for tests
- 1:46:00Testing! Lets test App.js
- 1:48:00Adding react-testing-library to our application
- 1:59:00Adding Jest coverage (good practise to do so)
- 2:02:00Testing the StoriesContainer.js
- 2:03:40Testing the Story.js component
- 2:10:00Testing the HnApi.js file
- 2:22:18Looking at our coverage and more testing!
- 2:22:53Collecting coverage from the right places
- 2:25:43Looking at React memo
- 2:27:33Adding memo to Story.js to prevent additional Api calls
- 2:29:18Overview of what we have achieved!
- 2:30:29Running our application through Lighthouse!
- 2:33:00Thanks for watching, I hope you learned a lot!
Show the creator's full description
Learn how to use APIs with React in this intermediate tutorial. We're going to be creating a small application in React that calls the Hacker News API. We'll be looking at React memo, Axios (to make API calls), styled components, and finally we will test our work using React Testing Library.
Once we have done all this we will run our application through Lighthouse (a browser extension) that allows us to test for accessibility, performance and so much more. We will be making 500+ automated API calls in this application, and I want to show you how to use memo with React so that we can avoid making multiple network calls if we already have the data.
💻 Code: https://github.com/karlhadwen/newsreader
🎥 Video by Karl Hadwen. Check out his YouTube channel: https://youtube.com/c/cognitivesurge
🐦 Karl on Twitter: @karlhadwen
Check out part 2 where Karl teaches how to use Apollo Server 2 and GraphQL: https://www.youtube.com/watch?v=M0nIFRd8DXU
❤️ Try interactive React courses we love, right in your browser: https://scrimba.com/freeCodeCamp-React (Made possible by a grant from our friends at Scrimba)
⭐️ Course Contents ⭐️
⌨️ (0:00:00) Introduction (what are we building?), tech stack talk
⌨️ (0:01:50) Using create-react-app as our base
⌨️ (0:03:30) Stripping out the files & content that we do not need
⌨️ (0:05:00) Refactoring to named exports
⌨️ (0:08:35) Modifying our .env file
⌨️ (0:09:15) Scaffolding our application
⌨️ (0:10:15) Looking at the Hacker News Api
⌨️ (0:11:50) Looking at all the news article Ids
⌨️ (0:12:58) Adding Axios using Yarn
⌨️ (0:13:00) Creating our hnApi.js service file
⌨️ (0:15:07) Adding the ability to get all story Ids from HN Api
⌨️ (0:17:14) Starting work on App.js
⌨️ (0:22:30) Adding useEffect to App.js to show all story Ids
⌨️ (0:30:00) Explaining how useEffect works
⌨️ (0:36:00) Creating our StoriesContainer.js container/component
⌨️ (0:37:50) Adding the ability to get stories from HN Api
⌨️ (0:39:50) Demonstrating the results that we receive from the HN Api
⌨️ (0:41:30) Creating our Story.js component file
⌨️ (0:43:15) Adding our Story component to the StoriesContainer component
⌨️ (0:44:10) Adding storyId as a prop to the Story.js component
⌨️ (0:46:40) Adding state to our Story.js component
⌨️ (0:47:10) Using useEffect to get a story in our Story.js component
⌨️ (0:47:40) Adding validation when getting stories
⌨️ (0:49:00) Dumping our stories onto the page
⌨️ (0:49:55) Building out the Story.js component with real data
⌨️ (0:53:20) Adding a selector for the story fields
⌨️ (0:56:00) Adding styled components
⌨️ (0:57:00) Building out our StoryStyles.js file using styled components
⌨️ (0:59:00) Adding a title to StoriesContainer.js
⌨️ (1:00:00) Adding a StoryWrapper to our Story.js component
⌨️ (1:01:50) More work on styling
⌨️ (1:02:30) Adding styling for StoryMeta
⌨️ (1:03:55) Adding styling for StoryMetaElements & styled component props
⌨️ (1:04:55) Adding our styled components to our Story.js component
⌨️ (1:11:30) Adding StoriesContainerStyles for more styling on the container
⌨️ (1:12:05) Looking at adding global styles (createGlobalStyle)
⌨️ (1:13:00) Adding our container styles to StoriesContainer.js
⌨️ (1:14:55) Brief look at the React profiler
⌨️ (1:16:00) Quick run through as to what we have built so far
⌨️ (1:18:10) Making our time display properly using mapTime.js
⌨️ (1:22:00) Adding InfiniteScroll to our application (custom hook)
⌨️ (1:22:40) Constants to be used by InfiniteScroll for per page items
⌨️ (1:39:05) Adding debounce functionality for scrolling
⌨️ (1:42:00) Adding a fixture folder with fixtures for tests
⌨️ (1:46:00) Testing! Lets test App.js
⌨️ (1:48:00) Adding react-testing-library to our application
⌨️ (1:59:00) Adding Jest coverage (good practise to do so)
⌨️ (2:02:00) Testing the StoriesContainer.js
⌨️ (2:03:40) Testing the Story.js component
⌨️ (2:10:00) Testing the HnApi.js file
⌨️ (2:22:18) Looking at our coverage and more testing!
⌨️ (2:22:53) Collecting coverage from the right places
⌨️ (2:25:43) Looking at React memo
⌨️ (2:27:33) Adding memo to Story.js to prevent additional Api calls
⌨️ (2:29:18) Overview of what we have achieved!
⌨️ (2:30:29) Running our application through Lighthouse!
⌨️ (2:33:00) Thanks for watching, I hope you learned a lot!
--
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://www.freecodecamp.org/news
Description and video by freeCodeCamp.org. This page is an independent companion view; the video is embedded from YouTube.