Deep Dive: Understanding Props
1. The Functional Philosophy
React components are essentially functions. In JavaScript, functions receive arguments. In React, components receive Props. This allows us to use the same component logic to render different data.
2. Immutability (Read-Only)
One of the most important rules in React is that Props must be pure. A component must never modify its own props. If you need to change a value based on user interaction, you should use State, not props.
3. Passing Functions (Callbacks)
Since React follows a "top-down" data flow, how does a child tell a parent something happened? By calling a function passed as a prop.
View Additional Patterns+
Props drilling occurs when you pass data through many layers to get it to a deeply nested component. To fix this, you might eventually look into Context API or state management tools like Redux and Zustand.
