Skip to content
BENIBIX Learn

Props vs State

Props are the inputs a part gets from the part above it, and it should not change them. State is data a part owns and can change, and the screen follows it.

Development🌐 Web Development

Props

The inputs a component gets from the part that holds it.

Props are the inputs a parent component passes to a child component. They let one component show different things in different places, like a different name or price. A child reads its props but should not change them. If something needs to change, the parent changes the value and passes it down again. The name is short for properties.

Example
Lucy's page uses the same Button component three times. Its label prop is Save, Cancel and Delete.
Why it matters
Props are what make components reusable. Data flows down through them.
Full entry
Development🌐 Web Development

UI State

The data a page holds right now that can change, like a count.

State is the data a page holds right now that can change. A count, a typed word or an open menu are all state. When the state changes, the framework draws the affected parts of the page again. You do not change the screen by hand; you change the state, and the screen follows. State can live in one component or be shared across the whole app. Keeping it small and in one place makes bugs rarer.

Example
Jack's cart icon shows a number. That number is state, and adding a mug changes it from 2 to 3.
Why it matters
Most front-end bugs are state bugs. Knowing where state lives makes them easy to find.
Full entry

In one line

Props
The inputs a component gets from the part that holds it.
UI State
The data a page holds right now that can change, like a count.