State Vs Props | Compare

quick compare

For parent-child communication we use State and Props

Use state to store the data your current page needs in your controller-view. Use props to pass data & event handlers down to your child components. These lists should help guide you when working with data in your components.

Props

  • are immutable

    • which lets React do fast reference checks

  • are used to pass data down from your view-controller

    • your top level component

  • have better performance

    • use this to pass data to child components

State

  • should be managed in your view-controller

    • your top level component

  • is mutable

  • has worse performance

  • should not be accessed from child components

    • pass it down with props instead

Last updated