Alex Heitzmann
Mar 22 · 1 min read

I would recommend trying to unit test your mapStateToProps and mapDispatchToProps functions, since they are critical to the correct functioning of the component. Admittedly it can be a pain to do this, so in the mean time if you want to exclude those functions from code coverage I don’t see any problem with pulling your inner component out into another file; just make a package for your component and have the index export only the connected component.

my-component-inner.tsx // exports _MyComponent
my-component.tsx // exports MyComponent wrapping _MyComponent
index.ts // re-exports MyComponent

    Alex Heitzmann

    Written by