Skip to content

Latest commit

 

History

History
 
 

readme.md

Chapter 6 : Props, State, and the Component Tree

Data handling within component trees is one of the key advantages of working with React. There are techniques that you can use when working with data in React components that will make your life much easier in the long run.

Samples

Property Validation and default Props

Validation with prop-types

  1. Incorrect properties do not always show errors ( demo, code, bin)
  2. Introducing prop-types npm ❌ ( demo, code, bin)
  3. PropTypes success ( demo, code, bin)
  4. cryptic problems when prop missing ❌ ( demo, code, bin)
  5. better errors with .isRequired ❌ ( demo, code, bin)
  6. catching validation errors ❌ ( demo, code, bin)
  7. default properties ( demo, code, bin)
  8. custom validation ❌ ( demo, code, bin)
  9. stateless prop validation ❌ ( demo, code, bin)
  10. stateless default props ( demo, code, bin)

Refs

  1. Color component (demo, code, bin)
  2. Color component with refs (demo, code, bin)
  3. Two way data binding (demo, code, bin)
  4. Two way data todo note (demo, code, bin)
  5. without a default function prop ❌ (demo, code, bin)
  6. checking for the function property (demo, code, bin)
  7. using a default function property (demo, code, bin)
  8. stateless default function property (demo, code, bin)
  9. stateless default argument function property (demo, code, bin)

Component State

  1. The Star Component ( demo, code, bin)
  2. The Star Rating Component Class ( demo, code, bin)
  3. Setting State From Props ( demo, code, bin)

State within the Component Tree

  1. Color Organizer App (demo, source)