Sprint Challenge: React - Star Wars

This challenge allows you to practice the concepts and techniques learned over the past Sprint and apply them in a concrete project. This Sprint explored ReactJS, Function Components, component state and side effects. In your challenge for this Sprint, you will demonstrate proficiency by creating an application that uses ReactJS to consume live data retrieved from the World Wide Web and style that data nicely on the page.

Instructions

Read these instructions carefully. Understand exactly what is expected before starting this Sprint Challenge.

This is an individual assessment. All work must be your own. Your challenge score is a measure of your ability to work independently using the material covered through this sprint. You need to demonstrate proficiency in the concepts and objectives introduced and practiced in preceding days.

You are not allowed to collaborate during the Sprint Challenge. However, you are encouraged to follow the twenty-minute rule and seek support from your PM and Instructor in your cohort help channel on Slack. Your work reflects your proficiency with ReactJS Fundamentals and your command of the concepts and techniques in the Functional Components.

You have three hours to complete this challenge. Plan your time accordingly.

Commits

Commit your code regularly and meaningfully. This helps both you (in case you ever need to return to old code for any number of reasons and your Team Lead.

Description

In this challenge, create a web page that presents a styled list of Star Wars characters. Being able to render out data to a web page is a large part of what JavaScript developers do, this challenge assesses your ability to achieve such a task.

Self-Study/Essay Questions

Demonstrate your understanding of this Sprint's concepts by answering the following free-form questions. Edit this document to include your answers after each question. Make sure to leave a blank line above and below your answer so it is clear and easy to read by your project manager.

  • What is React JS and what problems does it try and solve? Support your answer with concepts introduced in class and from your personal research on the web.

    React is a frontend library for Javascript, which is often times referred to a framework. It aims to solve the issue with large applications and rendering those applications over and over with the DOM. It uses a virtual DOM and only updates the components it needs to.

  • What does it mean to think in react?

    Not entirely sure, but my guess would be to think in components. Make everything reusable, dry, and able to be scaled for fast updating of DOM.

  • Describe state.

    State is exactly that - the state of a particular component on a webpage or in an application. We store state with hooks in this iteration of the curriculum and manipulate the state according to user interaction.

  • Describe props.

    Props are like everything in Javascript an object. It is information stored in an object and able to be passed down in a unilateral direction to give components access to the data/ properties of another component.

  • What are side effects, and how do you sync effects in a React component to state or prop changes?

    Side effects are effects that are caused by things like API's when we are receiving information we are unsure as to what may be returned. This can cause issues for programs and we store that information in a hook we now call useEffect. It handles those effects and syncs them according to the current state of various components or data.

Project Set Up

Follow these steps to set up and work on your project:

  • Create a forked copy of this project.
  • Add TL as collaborator on Github.
  • Clone your OWN version of Repo. (Not Lambda's by mistake!)
  • Create a new Branch locally: git checkout -b <firstName-lastName>.
  • Change directories into ./starwars (cd starwars) and run yarn install or npm install to retrieve all needed dependencies.
  • Once you have installed the node_modules, run yarn start or npm start to get your server up and running.
  • With the server up and running, open Chrome and head over to localhost:3000 and view your beautiful app. Maybe it's not that pretty... yet, your goal is to ensure this project becomes a thing of beauty. Follow these steps for completing your project.
  • Implement the project on this Branch, committing progress & changes often.
  • Push commits: git push origin <firstName-lastName>.

Follow these steps for completing your project:

  • Submit a Pull-Request to merge Branch into master (student's Repo).
  • Add your Project Manager as a Reviewer on the Pull-request.
  • PM then will count the HW as done by merging the branch back into master.

Minimum Viable Product

Your finished project must include all of the following requirements:

  • Fetch a list of Star Wars characters from the Star Wars API (or SWAPI) and render them to the screen.
  • Follow the documentation to learn how to fetch a list of "people". However, don't spend too long on this. Here is a link for you to follow if you've looked around the docs for about 15 minutes or so and haven't found where to go - Secret Link to Awesomeness šŸ¤«.
  • Set the data you fetch to state.
  • Map over the list and render a component for each character on the page.
  • You must display at least one element for each star wars character in the data set.
  • The elements must be styled with either SemanticUI or styled-components - don't rely on browser default styles.

Required best practices:

  • Consistent naming. Examples: variables, functions, Components, and file/folder organization.
  • Consistent spacing. Examples: line breaks, around arguments and before/after functions.
  • Consistent quotation usage.
  • Spell-check.
  • Schedule time to review, refine and reassess your work.

It is better to submit a challenge that meets MVP than one that attempts too much and fails.

Stretch Problems

  • Add at least one test using a testing tool:

  • Build a pagination system that will allow you to load the next page of data.

    • console.log() the data coming back from the server.
    • Notice that there are next and previous fields that give you a URL.
    • You can build a function that will get characters called getCharacters that you can use dynamically to get the next or previous set of characters. You would need to supply it with the proper fields, and you'll need to set up more state to do this.