Giter Site home page Giter Site logo

react-prop-types-lab-g-416's Introduction

React PropTypes Lab

Overview

In this lab, you'll use PropTypes declaration in a variety of scenarios.

A new job

Michael Scott

Welcome to your first day at... Dunder Mifflin! Your job is to make sure the company's products are catalogued on the website. Since we like to be modern, we'll use React to display the product information. Since our database is pretty old, we'll be sure to add PropTypes to our component so that we know we're passing in the right props.

  1. In the components/Product.js file, create a Product React component.
  2. This component has the following props:
    • name: a string — required
    • producer: a string — optional
    • hasWatermark: a boolean — optional, defaults to false
    • color: a string — required, can only be 'white', 'eggshell-white' or 'salmon'
    • weight: a number — required, ranges between 80 and 300
  3. Note: for the weight prop, we'll need custom logic. Remember that it's possible to write your own prop validator function!

Resources

react-prop-types-lab-g-416's People

Contributors

thomastuts avatar annjohn avatar pletcher avatar dom-mc avatar

Watchers

James Cloos 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.