I am new to the reaction-reduction world and have some problems visualizing part of a complex data stream (I think).
Suppose a state contains a collection of tracks and an array of favorite tracks. A user may like a track from several different components, for example. the music player, tracklist, charts, and everyone else should have rebooted.
I am currently running an action to add / remove track ID to / from my favorites array. But I can’t figure out how to proceed from there.
My plan is to trigger another action, for example. trackItem reducer for listening and continuing. Or can each related component directly subscribe to a collection of favorites? Or do I have two gearboxes that listen to the same action? Now I have an idea how to implement something similar, and also I have a feeling that I'm on the wrong track.
I feel that I am trying my best to get rid of my puppet magic habits. How do you do this?
My other plan is to have isFavorited boolean in the json track element and use action / reduce to update / switch this property. I understand that normalizr will merge instances with the same identifier, so any component that subscribes to its changes will respond.
source
share