I have written a three part series to create a youtube player. It used only React and heavily depends on callbacks from children to parent and in one case two level deep.
We can solve this issue using three solutions — Flux, Redux , Context API. We will look into solving this with Flux in this tutorial.
We will first look briefly into what is Flux. Flux also follows the unidirectional flow of react, but it’s a closed circle. It have four parts — The React components, Actions, dispatcher and Store
It either creates an action or listen for a change in store or do both.
Do some action when triggered from component and pass it to dispatcher
Just a middleman, sends actions to all stores
Manages the logic and emits the changes, to be picked up by components.
We only need three components in this Flux refactoring. The basic flow will be as below. We will understand it more, once we build it.
You can read rest of the blog from my blog site. The link is below.