|
1 | | -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). |
| 1 | +# Module Project: Comppnent Lifecycle Method - React Github User Card |
2 | 2 |
|
3 | | -## Available Scripts |
| 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 | 4 |
|
5 | | -In the project directory, you can run: |
| 5 | +## Instructions |
6 | 6 |
|
7 | | -### `npm start` |
| 7 | +**Read these instructions carefully. Understand exactly what is expected _before_ starting this project.** |
8 | 8 |
|
9 | | -Runs the app in the development mode.<br> |
10 | | -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. |
| 9 | +### Commits |
11 | 10 |
|
12 | | -The page will reload if you make edits.<br> |
13 | | -You will also see any lint errors in the console. |
| 11 | +Commit your code regularly and meaningfully. This helps both you and your team lead in case you ever need to return to old code for any number of reasons. |
14 | 12 |
|
15 | | -### `npm test` |
| 13 | +### Description |
16 | 14 |
|
17 | | -Launches the test runner in the interactive watch mode.<br> |
18 | | -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. |
| 15 | +In this project you'll take this crypto currency tracker app and build two custom hooks that, when composed together, will allow users to set and persist a dark mode preference. |
19 | 16 |
|
20 | | -### `npm run build` |
| 17 | +## Project Set Up |
21 | 18 |
|
22 | | -Builds the app for production to the `build` folder.<br> |
23 | | -It correctly bundles React in production mode and optimizes the build for the best performance. |
| 19 | +- [ ] Create a forked copy of this project. |
| 20 | +- [ ] Add your team lead as collaborator on Github. |
| 21 | +- [ ] Clone your OWN version of the repository in your terminal |
| 22 | +- [ ] Use CRA to create a new React app in this repository |
| 23 | +- [ ] Create a new branch: git checkout -b `<firstName-lastName>`. |
| 24 | +- [ ] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly. |
| 25 | +- [ ] Push commits: git push origin `<firstName-lastName>`. |
24 | 26 |
|
25 | | -The build is minified and the filenames include the hashes.<br> |
26 | | -Your app is ready to be deployed! |
| 27 | +Follow these steps for completing your project. |
27 | 28 |
|
28 | | -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. |
| 29 | +- [ ] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repository). **Please don't merge your own pull request** |
| 30 | +- [ ] Add your team lead as a reviewer on the pull-request |
| 31 | +- [ ] Your team lead will count the project as complete by merging the branch back into master. |
| 32 | +- [ ] Do your magic! |
29 | 33 |
|
30 | | -### `npm run eject` |
| 34 | +## Minimum Viable Product |
31 | 35 |
|
32 | | -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** |
| 36 | +- [ ] Fetch data from the Github API for a Github user |
| 37 | +- [ ] Display the user data on the DOM |
| 38 | +- [ ] Use class components when you need to hold any state or use any lifecycle methods |
33 | 39 |
|
34 | | -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. |
| 40 | +## Planning your App |
35 | 41 |
|
36 | | -Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. |
| 42 | +This is an important step for any project you will be working on. You will want to plan out what data you will need, which component will manage that data via state, what functions you may need to update that state, and where you need to pass the data to render it to the DOM. I love to use pen and paper or a whiteboard for this. The visuals can help a lot when you're deep into your code. After I finish that, I will write out a list of steps that I think it will take to build the app. This gives me a starting point, and direction as I proceed. This list always changes a bit as you are building, but it should give you a good flow and some good anchor points. |
37 | 43 |
|
38 | | -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. |
| 44 | +When you have those completed, you're ready to start coding! |
39 | 45 |
|
40 | | -## Learn More |
| 46 | +## STEP 1 - Fetch the User Data |
41 | 47 |
|
42 | | -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). |
| 48 | +- When your component mounts, send a GET request to the following URL (replacing the palceholder with your Github name): |
| 49 | + - https://api.github.com/users/<your name> |
| 50 | +- After you fetch your data, set it to state |
43 | 51 |
|
44 | | -To learn React, check out the [React documentation](https://reactjs.org/). |
| 52 | +## STEP 2 - Display the user data |
45 | 53 |
|
46 | | -### Code Splitting |
| 54 | +- Pass the data to the component that will be displaying it |
| 55 | +- Build out a user card using the data that the Github API returns to you |
| 56 | + - You may reference your old project for this, or you may wish to build this from scratch yourself |
47 | 57 |
|
48 | | -This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting |
| 58 | +## STEP 3 - Fetch the User's Followers |
49 | 59 |
|
50 | | -### Analyzing the Bundle Size |
| 60 | +- When your component mounts, you will also fetch the user's followers using this endpoint: |
| 61 | + https://api.github.com/users/<Your github name>/followers |
| 62 | +- Set that data to state as well, and display the data in your app |
51 | 63 |
|
52 | | -This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size |
| 64 | +## STEP 4 - Style the User Card |
53 | 65 |
|
54 | | -### Making a Progressive Web App |
| 66 | +- Now it's time to style up your app |
| 67 | +- You are free to choose how you style your app, but make it look as presentable as you can |
| 68 | +- Try something new here. Maybe that's a new CSS technique you haven't really practiced yet. Maybe it's using a styling library you haven't tried. Push yourself to get better in this area. |
55 | 69 |
|
56 | | -This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app |
| 70 | +## STEP 5 - Project Retrospective |
57 | 71 |
|
58 | | -### Advanced Configuration |
| 72 | +Now that you have completed the MVP, I want you to think about the process it took you to get here. Is there anything you wish you had planned better? Anything you would do differently? Now take a minute think about how you would accomplish these same objectives with function components and hooks. You have experience with both formats now, so you can form opinions, but more importantly, you can back up those opinions. That's a really exciting level to be at! If you have time now, go ahead and move onto the stretch problems. |
59 | 73 |
|
60 | | -This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration |
| 74 | +## Stretch Problems |
61 | 75 |
|
62 | | -### Deployment |
| 76 | +After finishing your required elements, you can push your work further. These goals may or may not be things you have learned in this module but they build on the material you just studied. Time allowing, stretch your limits and see if you can deliver on the following optional goals: |
63 | 77 |
|
64 | | -This section has moved here: https://facebook.github.io/create-react-app/docs/deployment |
| 78 | +- Build a form that allows you to search for different Github users. When the form is submitted, use `componentDidUpdate` to fetch the data for the user you typed in. Set that new user's data to state to trigger the component to rerender and display your new user. Don't forget to fetch their followers as well. |
65 | 79 |
|
66 | | -### `npm run build` fails to minify |
67 | | - |
68 | | -This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify |
| 80 | +- Look into adding your GitHub contribution graph. There are a number of different ways of doing this, this Stack Overflow discussion will get you started: https://stackoverflow.com/questions/34516592/embed-github-contributions-graph-in-website |
0 commit comments