Code Monkey home page Code Monkey logo

sprint-challenge-react-wars's Introduction

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, Functional Components and Class Components. 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 ReactJS Fundamentals and your command of the concepts and techniques in the Function Components and Class 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 project manager.

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 JS is a JavaScript framework developed by Facebook to help make large webpages more interactive. One of the biggest concepts behind React to help make this possible is state and setState(), which is used to store data, and re-render the page whenever it is changed. It can do so quickly with the virtual DOM which allows it to only change elements that are affected by any given change in state, rather than the entire page.

  • What does it mean to think in react?

Thinking in react is the thought process suggested by the developers of react to best make use of the tools it offers. It starts by identifying potential components that should be created, and then building a basic framework using those components. From there, you can start to add functionality by identifying where you should declare state, what information it needs, and how you need to modify it

  • Describe state.

State is a class object in React that holds all the data for a given class. When changes are made to State, any elements that would be affected are re-rendered, allowing for better reactive UI

  • Describe props.

Props is an object that holds data from state. It is created when a function that accepts props is invoked, and it is passed as an argument for that function

Project Set Up

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

  • Create a forked copy of this project.
  • Add PM as collaborator on Github.
  • Clone your OWN version of Repo (Not Lambda's by mistake!).
  • Create a new Branch on the clone: git checkout -b <firstName-lastName>.
  • Change directories into ./starwars (cd starwars) and run yarn install to retrieve all needed dependencies.
  • Once you have installed the node_modules, run yarn start or 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 changes regularly.
  • 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.

Please note:

  • componentDidMount() calls an open sourced API inside of App.js and saves the results of that API on state.
  • Upon opening the App.js file you'll see that there is code written out that looks like this:
componentDidMount() {
  this.getCharacters('https://swapi.co/api/people');
}

getCharacters = URL => {
  fetch(URL)
    .then(res => {
      return res.json();
    })
    .then(data => {
      this.setState({ starwarsChars: data.results });
    })
    .catch(err => {
      throw new Error(err);
    });
};
  • You don't need to understand what that code is doing fully, other than the fact that it is setting your state with Star Wars Character Data.
  • View your App component's state by opening the Chrome React Dev Tools to peek at the data set. At this point you will know what to do from here.

Your data set will look like this:

Star Wars state data

  • Based on knowledge gained over the past Sprint

Minimum Viable Product

Your finished project must include all of the following requirements:

  • A list of Star Wars Characters rendered to the screen.
  • You must have at least one list element for each star wars character in the data set.
  • The list elements must all be styled beyond the basic

In your solution, it is essential that you follow best practices and produce clean and professional results. Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. It is better to submit a challenge that meets MVP than one that attempts to much and does not.

Stretch Problems

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

  • Take note on the data that's coming back from the server call in our getCharacters

  • console.log() the data coming back from the server.

  • Notice that there are next previous fields that give you a URL.

  • You have a function that will get chars called getCharacters you'll want to just call this function and supply it with the proper fields. You'll need to set this up on state to do this.

 .then(data => {
    console.log(data); <-- Log data here to find the fields you will need.
    this.setState({ starwarsChars: data.results });
  })
  • Build another app from scratch that looks very similar to this one. Inside of your main App component fetch some data in this same fashion from this url https://dog.ceo/dog-api/#all you'll have to follow the documentation at that website and figure out how to change up the code you've seen here in this Star Wars app in order to properly fetch the data and store it on Component State.

  • Be mindful of the fetch API that is now built into most modern browsers Fetch API.

  • Your data coming back from Dogs should be formatted in JSON format.

sprint-challenge-react-wars's People

Contributors

awsafran avatar dustinmyers avatar eeevvaaa avatar luishrd avatar mixelpixel avatar ryan-hamblin avatar seanchen1991 avatar sunjieming avatar

Watchers

 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.