|
| 1 | +# Component Lifecycle Methods - React Github User Card |
| 2 | + |
| 3 | +This project allows you to practice the concepts and techniques learned in this module and apply them in a concrete project. This module explored lifecycle methods in class components. In your project you will demonstrate proficiency of these concepts by recreating the Github User Card project, but as a React application this time. |
| 4 | + |
| 5 | + |
| 6 | +## Objectives |
| 7 | +- Build class components from scratch from a Storyboard |
| 8 | +- Get comfortable creating multiple slices of state |
| 9 | +- Use ComponentDidMount to make an API call |
| 10 | +- Use ComponentDidUpdate to make an API call |
| 11 | + |
| 12 | +## Introduction |
| 13 | +In this project you will build an application that allows for github user and follower information to be retrieved and displayed within custom made DOM. You application should do the following: |
| 14 | +- Hold both the current user, user and follower state within the App.js component. |
| 15 | +- Load the current user state into the user state on mount. |
| 16 | +- Load the current user's followers into state when the current user state is updated. |
| 17 | +- Load the the user and follower information of the username typed into a form when submitted. |
| 18 | + |
| 19 | +<!--  --> |
| 20 | + |
| 21 | +***Make sure to complete your tasks one at a time and complete test each task before proceding forward.*** |
| 22 | + |
| 23 | +## Instructions |
| 24 | +### Task 1: Project Set Up |
| 25 | +* [ ] Create a forked copy of this project. |
| 26 | +* [ ] Clone your OWN version of the repository in your terminal |
| 27 | +* [ ] cd into the project base directory `cd web-module-project-lifecycle` |
| 28 | +* [ ] Download project dependencies by running `npm install` |
| 29 | +* [ ] Start up the app using `npm start` |
| 30 | + |
| 31 | +### Task 2: Project Requirements |
| 32 | +#### Build your DOM |
| 33 | +> *Creating the DOM for your application base on your template and data* |
| 34 | +* [ ] Take a look at the [included mockup](./card_mockup.png). |
| 35 | +* [ ] Use your browser to take a look at the data returned when using the following endpoints: https://api.github.com/users/<Your github name> and https://api.github.com/users/<Your github name>/followers |
| 36 | +* [ ] Using these three pieces of information, build the DOM necessary to display all application information. |
| 37 | +* [ ] Make use of the User.js (for holding all user information), FollowerList.js (for map through a followers list) and Follower.js (for displaying an individual follower) components to efficiently distribute your code. ***All components should be class based for this assignment.*** |
| 38 | +* [ ] Feel free to leave the search form within App.js. |
| 39 | +* [ ] Lightly style as needed. |
| 40 | +* [ ] Commit all changes before proceeding. |
| 41 | + |
| 42 | +#### Add in your state |
| 43 | +> *Now that we have all the DOM necessary to run our application, let's proceed to building in our state* |
| 44 | +* [ ] In App.js, add in state. Include a slice for state for: |
| 45 | + - A string defining the user we are currently searching for |
| 46 | + - An object containing all user information |
| 47 | + - The array of all followers |
| 48 | +* [ ] Using our two github endpoints as a base, add your github user name, as well as test data for the user object and followers array to insure it is connected correctly. |
| 49 | +* [ ] Connect make sure that the test data within state correct displays within your User, FollowerList and Follower components. |
| 50 | + |
| 51 | +#### Load in the user and follower on mount |
| 52 | +> *We can now do our api calls to get our initial data* |
| 53 | +* [ ] Make our user object and follower list state empty by default. |
| 54 | +* [ ] Keep our searched user state your github username by default. |
| 55 | +* [ ] Use componentDidMount to load initial user data for your github name into state. |
| 56 | +* [ ] Use componentDidUpdate to load follower information ***only when the user slice of state changes value. Make be careful to avoid infinite loops while building this portion.*** |
| 57 | + |
| 58 | +#### Build search capabilities within your APP |
| 59 | +> *Now let's allow users to search for new github usernames* |
| 60 | +* [ ] Connect your form in App.js so that typing into a input updated your current user state. |
| 61 | +* [ ] When your form is submitted, make an api call on current user. Set the returned user data to state. |
| 62 | +* [ ] Ensure that followers is correctly updated. |
| 63 | + |
| 64 | +### Task 3: Stretch goals |
| 65 | +- [ ] We are making several api calls of the same type in our code. How can we make this portion more dry? |
| 66 | +- [ ] Add in functionality so that when a follower is clicked, they will become the searched user. Have the UI update approprately. |
| 67 | +- [ ] Push your styling! Have fun! |
0 commit comments