Skip to content

Comment on Redux-query – A React/Redux library for querying and managing network stateparent

Comments

There are two ways to make them more loosely coupled:

1. declare your connect's in a separate file that import your component and live alongside your containers, actions, reducers, etc.

2. write your own connect HOC that brings in redux. If you read the connect source[0] you'll find that it is actually really simple at it's core - but it is over complicated by having to account for so many use cases - your own HOC could/should be ~30 lines

I now use 2. because it produces proper separation and makes it easy to swap out components later on (or use more than one).

[0] https://github.com/reactjs/react-redux/blob/master/src/conne...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.