In this lab, you'll use PropTypes declaration in a variety of scenarios.
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.
components/Product.jsfile, create a
name: a string — required
producer: a string — optional
hasWatermark: a boolean — optional, defaults to false
color: a string — required, can only be
weight: a number — required, ranges between 80 and 300
weightprop, we'll need custom logic. It's possible to write your own prop validator function. Make sure you reference the documentation and use your Google-Fu if you are having trouble!
Note: This lab might require you to restart the test watcher after changing your code.