What does data flow mean in the context of react props?
Hi, I just watched Theo's AI job interview video and was curious about the part where he mentions react props being used for data and data flow. What does data flow mean in the context of a react app? Does it have something to do with streams? For context, I did a bit of dabbling with react around the time that hooks came out (haven't touched it in a while), and my understanding of react props was that they were just used for passing data to components.
3 Replies
As far, as I understand, that’s just more technical way of saying, that you’re passing props form parent to child component
That’s what is “unidirectional dataflow”
It has nothing to do with streams directly
It's basically what it sounds like I think. You can pass props through to a component as a way of controlling the flow of data throughout your application (determining which components and therefore pieces of UI receive which pieces of data etc).
I think the key issue he had with the original answer was that props aren't just for passing data, they can also pass functions / callbacks, which are a way of supplying data to parent components.
Gotcha, thanks for the clarification.