Refactoring Youtube Player to use Flux — Part 1

Image for post
Image for post

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

React Component
It either creates an action or listen for a change in store or do both.

Actions
Do some action when triggered from component and pass it to dispatcher

Dispatcher
Just a middleman, sends actions to all stores

Store
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.

Flux flow for Youtube Player

You can read rest of the blog from my blog site. The link is below.

Written by

UI Lead- ReactJS, JavaScript and everything in-between.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store