Working with GitHub pull requests
Get the project source code below, and follow along with the lesson material.
Download Project Source CodeTo set up the project on your local machine, please follow the directions provided in the README.md
file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.
Lesson Transcript
[00:00 - 01:45] working with github pull requests pull requests are very similar to issues as they are also bound to specific repositories in this lesson we'll define the routing inside of the src pull requests create a new file pull requests main tss here we define the pull request main component we'll need to get a history use history we'll use it to implement navigation and we'll need to get the match use route match we'll use it to construct the URL we'll need the ref use ref define the layout it's gonna have a panel inside of which it will have a title pull requests an instruction to click on the buttons or press the keys for navigation a bottom to list the pull requests and a bottom to create a new pull request let's define a callback to list the pull requests const go to new is gonna be a use callback hook where we debounce history push match URL / new we debounce by 100 milliseconds similar to that define go to list where we go to the list URL pass those functions to buttons as on press callbacks go to list and go to new and define a use effect that should subscribe to key presses on mount this is why we pass an empty array as a dependency list ref current key c go to new ref current key l go to list return a cleanup function and here we unkey c and unkey l now define the routing open the pull requests dsx instead of this panel now render a switch with a route for the main component for the pull requests here we also need the match to be able to continue the nested path define the path new where you'll render the new pull request component and path list for the list pull requests define the new and list pull requests stops
This lesson preview is part of the Fullstack React with TypeScript Masterclass course and can be unlocked immediately with a \newline Pro subscription or a single-time purchase. Already have access to this course? Log in here.
Get unlimited access to Fullstack React with TypeScript Masterclass, plus 70+ \newline books, guides and courses with the \newline Pro subscription.
![Thumbnail for the \newline course Fullstack React with TypeScript Masterclass](/_next/image?url=https%3A%2F%2Fs3.amazonaws.com%2Fassets.fullstack.io%2Fn%2F20220425171607321_CoverImage_FSReactWTypeScript_Masterclas.png&w=3840&q=75)