Closed fredcy closed 8 years ago
thanks a lot! I'll have to take a closer look later!
Isn't your proposal somehow close to the 2 mailboxes proposal I made here? https://github.com/slorber/scalable-frontend-with-elm-or-redux/issues/2
Btw @fredcy passing that context down to NewGif component, doesn't it couple it too much to our app? What if I'd like to reuse that NewGif component inside another application?
@slorber I'm not comprehending the discussion in https://github.com/slorber/scalable-frontend-with-elm-or-redux/issues/2. It sounds similar to what I did but I'm not fluent in React/Flux/Redux and not able to relate it all.
The context
does introduce some coupling but all the component sees is a Signal.Address ()
which serves as kind of a local outgoing port. The component does not know anything about the data types used by the parent or about how the parent uses the signal that results. I think that makes it reusable. However, any parent using the component has to provide that context parameter and a Signal.Address value to pass to it even if it doesn't care about the resulting signal, so that's a complication. I was rushing -- I might update the code to fix that.
My choice of NewGif
for the new top level action label was badly done since that can be conflated with the same-named action in the component.
I responded to your comment (https://github.com/fredcy/scalable-frontend-with-elm-or-redux/commit/ddb98dd26f36516e2d6f47b7b5269e5ea73acc1c#commitcomment-16469112) inline.
This version copies Peter's and then has the components send indications upward via a new context parameter to each update function.