/Pro-React-16_10_Components-props

Work based on Chapter 10 of Pro-React-16

Primary LanguageJavaScript

Pro-React-16_10_Components-props

Based on Chapter 10 of Pro-React-16

1. Create Example Project

  • Creates a generic React app

2. Understanding Components

  • Creates a simple component that returns text to be rendered
  • Introduces JSX to mix HTML and JavaScript and alternate syntax, including fat arrow
  • Adds child components

3. Understanding Props

  • Defines props in parent component
  • Receives props in child component

4. Combining JS and Props to render content

  • Selectively renders content in child component
  • Renders arrays
  • Renders multiple elements
  • Renders no content

5. Using function props

  • Passes functions through props

6. Passing props to child components

  • Uses props to abstract specific components to generic ones
  • Passes on all props to child component via destructuring operator

7. Using Default prop values

  • Defines set of default prop values

8. Type checking prop values

  • Adds propTypes to child component
  • Allows multiple types for a prop