Use a Default HOC for Component Logic


(Secretmapper) #1

This is a pattern I’ve employed in our internal codebase for some time now. I don’t see it in the wild often.

Essentially, it’s creating state management stuff in a separate HOC, so that you can use the state management HOC and presentational component independently, while allowing the HOC to be used as a sort of ‘default’.

This is the blog post where I explain it better:

Thoughts?


(Julian Krispel Samsel) #2

Or you could just use something like recompose and save yourself the trouble of writing your own hoc’s https://github.com/acdlite/recompose


(Secretmapper) #3

This is more of a pattern instead of a library - in fact I recommend using recompose to implement it.