0

To illustrate the use-case, I have a </video> tag that dispatches an action every time (~250ms) the playhead moves. I'm not a Flux/Redux's guru and I'm facing some issues:

  • Is it a valid approach ?
  • With a weighty state, may it cause performance issues ?
  • Do you have any optimisation proposals about subscribing to a part of the state changes ?

Many many thanks for you help !

yvan
  • 229
  • 2
  • 9

1 Answers1

0

I think the approach is reasonable (especially if you are wanting to use information from that video element across the application), and depending on the app/actions, there may be consequences.

If you are using React with Redux, the connect higher-order component can take a pure: true option to do a shallow compare of props in the shouldComponentUpdate callback that might help prevent too many re-renders.

Otherwise you could use a store enhancer or higher-order reducer to specially handle the actions fired by the video element. The redux-ignore middleware may help with that or provide a pattern for doing so.

max
  • 5,979
  • 2
  • 21
  • 16
  • Thanks for your clear answer ! As a side note for people having the same questions, https://github.com/andrewngu/sound-redux will give you some additional info. – yvan Nov 12 '15 at 00:01