Transcript from the "One-Way Data Flow" Lesson
>> Brian Holt: So let's talk about state. So what we've talked about before has been about props, right, child passing down data from the parents to the child. And something interesting and useful to talk about that, is the parents can pass down data to the child, but vice versa does not work, right?
[00:00:20] So the child, has no concept of who its parents are, which is sad, I suppose.
>> Brian Holt: But it can't interact with its parent, it can't do anything. The only thing it can do is accept data from its parents, and then do something with that data. This is called one-way data flow.
[00:00:41] That's one of the things that, I'm not gonna say React pioneered it, but it definitely made that popular in the front-end landscape. And now, definitely, Angular and Ember have adopted that into their frameworks. And it's been good for everyone all around. The reason why this is a really, really, really good thing, it kinda feels like it's tying one hand behind your back.
[00:01:00] So does it, but ends up being a huge net positive. If the most parent is having issues you can limit the children that's causing the issue, right? Because the children have no way to interact with the parents, right? So the problem has to live within the parent, that's what I wanted to assert.
[00:01:19] So in our particular case, right? If I have search and maybe search is having an issue here. I can already rest assured that ShowCard isn't causing any issues because ShowCard has no way to meddle with search, right? That's the power of one way data flow.
>> Brian Holt: So this is a powerful thing that I think, Facebook does really well in particular with React and some of their other libraries, is they really optimize for debugability and maintainability.
>> Brian Holt: And so this idea that you can see a problem and eliminate entire swaths of your code where that problem could not be is really powerful. Cuz you can start having an issue and you just get to eliminate two thirds of your app and you're just gonna instantly start looking within that one third, right?
[00:02:12] It's really, really powerful.
>> Brian Holt: So that's props, that's when my data flow. It's definitely a core tenet of react.