React Data Flow

Pascual Vila
Frontend Instructor // Code Syllabus
React's architecture forces developers to think about how data moves through an application. Components are like islands; they need bridges to share data.
Parent to Child: Props
The simplest and most common form of communication in React is passing data from a parent component down to a child component using props. Props are read-only to the child.
Child to Parent: Lifting State
Since props only go down, how does a child talk back to the parent? By executing a Callback Function that the parent passed down as a prop. This is known as "Lifting State Up".
Global Data: Context API
When passing props gets tedious (Prop Drilling) because you have to pass them through components that don't even use them, React offers the Context API. It creates a provider that wraps your app, allowing any child component to tap directly into the data stream.