Presentational and Container Components
Dan Abramov
25K80

Moving logic out of Containers

So, if I properly understood, Containers read the data directly from store and compose it with actions to provide the presentational components.

What if we move one step back, when we’re connecting the container to the store with the `connect` method and then we use the third argument (the one which gets props and actions usually called mergeProps) and put this logic there.

Plus, what if we put this function inside a selector (reselect function) so we can move it out from the file. This will make this function pretty easy to test and will keep the container just as a HTML combinator that gets what selector provides to feed its components.

The problem, then, could be that containers became a little bit useless.

Like what you read? Give carles a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.