Giter Site home page Giter Site logo

mod-4-mini-challenge-props's Introduction

React Mini Challenge: Props

Instructions

Fork this repo, then run git clone to download it locally. Then cd into the downloaded directory and open it in your text editor with code ..

Run npm install && npm start to get started.

Submitting

When you’re finished, run the following commands in your terminal to submit:

git add .
git commit -m 'Done'
git push

To get feedback on your code, make a pull request from your forked repo.

Assignment

Welcome to The Spice Store! We'll be building an application for displaying information about different spices. (If you're wondering where the ...interesting... spice descriptions came from - check out spicejungle.com)

The finished app should look like this:

Spice Store

In /components/App.js, there is a variable called spices that has an array of objects representing different spices.

You'll need to use that data to build out two features in our application:

  • Use the <Header> component to display the correct number of spices in our store
  • Use the <SpiceList> and <SpiceItem> components to display information about each spice

A few things to keep in mind as you are building out these deliverables:

  • How can we use props to pass data from one component to another?
  • If you're not sure what props you're getting, try adding a console.log or debugger in the component you're working on.
    • For class components, it's usually helpful to debug inside the render method (before the return statement).
    • For function components, try debugging inside the function body.
  • Make sure to draw out the component hierarchy so you can see the relationship between components!
  • Try to figure out what props to give our components by looking at code in the existing components.
  • Some of these components are class components and some are function components - this is to give you practice with the syntax for both kinds of component. How does this change how you can access props?

Extras

In our App component, the return statement looks like this:

return (
  <>
    <Header />
    <SpiceList />
  </>
);

Do some research - what does having <> and </> wrapped around our components do? (Hint: look up React.Fragment!)

mod-4-mini-challenge-props's People

Contributors

ihollander 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.