If you ever get errors about wrapWithConnect
taking a null or undefined component, it’s because you forgot to wrap the component.
Here's the error message I got, for convienence / reference:
wrapWithConnect(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.
wrong:
export default connect(mapStateToProps);
correct:
export default connect(mapStateToProps)(MyComponent);
the error is ambiguous if you come back from a long break (holiday, weekend) because it does not tell you the name of the component that’s causing the problem because it does not know what you didn’t pass.
Further compounding the problem, I supplied an ES6 arrow function as the first argument to connect (aka using an IIFE for mapStateToProps
)