2👍
Components can have both props
and data
. The difference between them is that props
are received by the parent component while data
are manipulated by the component. The props are static (changeable by the parent) while data are dynamic (but cannot be changed by the parent).
The only way a child component can affect a property is by emitting events. The parent component can listen to those events and receive and receive anything in the payload argument. In the listener function, they can change their own data and the child property will be updated as well. This is known as the one-way data flow:
All props form a one-way-down binding between the child property and the parent one: when the parent property updates, it will flow down to the child, but not the other way around. This prevents child components from accidentally mutating the parent’s state, which can make your app’s data flow harder to understand.
Here’s a little schema if you’re visual: