Giter Club home page Giter Club logo

web-module-project-lifecycle's Introduction

Component Lifecycle Methods - React Github User Card

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.

Objectives

  • Build class components from scratch from a Storyboard
  • Get comfortable creating multiple slices of state
  • Use ComponentDidMount to make an API call
  • Use ComponentDidUpdate to make an API call

Introduction

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:

  • Hold both the current user, user and follower state within the App.js component.
  • Load the current user state into the user state on mount.
  • Load the current user's followers into state when the current user state is updated.
  • Load the the user and follower information of the username typed into a form when submitted.

Make sure to complete your tasks one at a time and complete test each task before proceding forward.

Instructions

Task 1: Project Set Up

  • Create a forked copy of this project.
  • Clone your OWN version of the repository in your terminal
  • cd into the project base directory cd web-module-project-lifecycle
  • Download project dependencies by running npm install
  • Start up the app using npm start

Task 2: Project Requirements

Build your DOM

Creating the DOM for your application base on your template and data

  • Take a look at the included mockup.
  • Take a look at the data returned when using endpoint: https://api.github.com/users/< Your github name > and https://api.github.com/users/< Your github name >/followers
  • Using these three pieces of information, build the DOM necessary to display all application information.
  • 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.
  • Feel free to leave the search form within App.js.
  • Lightly style as needed.
  • Commit all changes before proceeding.

Add in your state

Now that we have all the DOM necessary to run our application, let's proceed to building in our state

  • In App.js, add in state. Include a slice for state for:
    • A string defining the user we are currently searching for
    • An object containing all user information
    • The array of all followers
  • 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.

Load in the user and follower on mount

We can now do our api call to get our initial data

  • Make our user object and follower list state empty by default.
  • Keep our searched user state your github username by default.
  • Use componentDidMount to load initial user data for your github name into state.
  • 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.

Build search capabilities within your APP

Now let's allow users to search for new github usernames

  • Connect your form in App.js so that typing into a input updated your current user state.
  • When your form is submitted, make an api call on current user. Set the returned user data to state.
  • Ensure that followers is correctly updated.

Task 3: Stretch goals

  • We are making several api calls of the same type in our code. How can we make this portion more dry?
  • Add in functionality so that when a follower is clicked, they will become the searched user. Have the UI update approprately.
  • Push your styling! Have fun!

web-module-project-lifecycle's People

Contributors

wlongmirebloomtech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.