In React, Unidirectional data flow describes a one-way data flow where
the data can move in only one pathway when being transferred between
different parts of the program.React, a Javascript library,
uses unidirectional data flow. The data from the parent is known
as props. You can only transfer data from parent to child and
not vice versa. This means that the child components cannot update
or modify the data on their own, makeing sure that a clean data flow
architecture is followed. This also means that you can control
the data flow better.
React Components act with: Data Down, Action Up
Data Down:
The first and more simple concept, “data down,” refers to the passing
of data and/or functions via props from parent to child components.
These props are passed down when a child component gets created.
We pass data down to child components so they can render them
on to the DOM.
Action Up:
Action Up refers to sending data back up to the parent from the child
component with the help of some action or event. Often these actions
are connected to a callback function.