Knowledge Maxxing
← Back to topic library
Dev MaxxingBeginnerReact60 sec

Props

Props are the input values passed into a React component from its parent, letting the same component render differently depending on what it's given.

Prerequisite: React component

What matters

Because props flow one way, from parent to child, a component's output can be reasoned about directly from its props, without hidden dependencies on outside state.

Example

A 'Greeting' component might receive a 'name' prop, rendering 'Hello, Ada' when passed 'name="Ada"' and 'Hello, Sam' when passed a different name.

Common misconception

A component cannot directly modify its own props; props are meant to be read-only from the receiving component's perspective.

Recall question

In which direction do props flow between components?

Keywords and related concepts

propscomponent inputReactreact component

Related topics

React component
Dev MaxxingBeginner
State
Dev MaxxingBeginner