0PricingLogin
React Academy · Lesson

Prop Getters & State Reducer (Light)

Expose safe handlers with prop getters and allow parents to alter transitions via a light state reducer.

Why getters + reducer

Goal: Make components flexible without complexity.

  • Prop getters: return safe props (handlers/aria/classes) to spread
  • State reducer: parent can alter transitions
  • Beginner-friendly, small pieces

Getters: safe composition

  • Expose getButtonProps(userProps)
  • Merge handlers with a tiny callAll helper
  • Add ARIA/state safely (e.g., aria-pressed)

All lessons in this course

  1. Trade-offs; Ref Patterns; Default Values
  2. Prop Getters & State Reducer (Light)
← Back to React Academy