So, uh, thanks.
Use a Render Prop
31–35 of 35 posts
Re: Use a Render Prop
#32Even using the term "higher order" that seems like a very OOP solution, while render props is very functional and thus a better idiom for JavaScript.
In fact, render as props is more an OOP pattern. You pass render functions as props and you use delegation pattern to pass context. https://en.wikipedia.org/wiki/Delegation_pattern
ReactTrainig maybe should fix react-router-redux to work with redux time travel.
Re: Use a Render Prop
#33Earlier quoted context omitted.
I definitely wasn't recommending that usage, just illustrating what it might look like. I personally think it looks much cleaner, which I would call an advantage. I've considered the first point, but hadn't thought about the second and third. I'm guessing the last point isn't a concern if you're using class properties for those? Given all this, if you were redesigning the API today, would you now make connect take th…
No. The reason why it's written as not just a HOC, but a curried-ish function is so that you could potentially reuse the "connection" definition for multiple components: const SpecificConnection = connect(mapState, mapDispatch); const ConnectedFirst = SpecificConnection(FirstComponent); const ConnectedSecond = SpecificConnection(SecondComponent); Admittedly, I suspect that use case isn't popping up very often. Most o…
const SpecificConnection = (Component) => connect(Component, mapState, mapDispatch);
Not that I'd argue against currying generally -- it's only that it turns out to be a little awkward here with the various optional parameters to connect, and also that the connection setup in practice seems to be tightly coupled to the connected component.Re: Use a Render Prop
#34What would the code look like to use this approach for Redux. Could Redux boilerplate be reduced?
Hi, I'm a Redux maintainer. First, could you clarify what _you_ mean by "Redux boilerplate" in this case? The phrase gets thrown around frequently, but it means different things to different people. Just yesterday, I tweeted some thoughts on how you can use as much abstraction as you want with Redux, and linked to examples of reusable action creator/reducer logic [0]. I also wrote a pair of blog posts that discuss th…
Re: Use a Render Prop
#35Earlier quoted context omitted.
Hi, I'm a Redux maintainer. First, could you clarify what _you_ mean by "Redux boilerplate" in this case? The phrase gets thrown around frequently, but it means different things to different people. Just yesterday, I tweeted some thoughts on how you can use as much abstraction as you want with Redux, and linked to examples of reusable action creator/reducer logic [0]. I also wrote a pair of blog posts that discuss th…
I love Redux. I just want it to take less code to use.
Ultimately, you can put as much or as little abstraction on top of Redux as you want.
[0] https://github.com/markerikson/redux-ecosystem-links/blob/ma...
[1] https://github.com/markerikson/redux-ecosystem-links/blob/ma...