mapDispatchToProps passess undefined props

Viewed 248

I have a seemingly trivial issue, but for the life of me I can't figure it out.

FooContainer.tsx

...
public render() {
  ...

  this.props.onSubmit(123) // FooContainer.tsx:81 Uncaught TypeError: this.props.onSubmit is not a function
}
...
export interface FooDispatchToProps {
  onSubmit: (bar: number) => Thunk; // <- from redux-thunk
}
const mapDispatchToProps = {
  onSubmit: submitFoo, // a thunk. From SomeDuck.ts
};   
export const FooContainerConnected = connect<{}, FooDispatchToProps, {}>(
    undefined,
    mapDispatchToProps,
)(FooContainer);

SomeDuck.ts

export function submitFoo(bar: number): Thunk {
    return (dispatch, getState) => {
        dispatch(submitFooAction(bar));
    };
}

The prop is not being passed with this shorthand notation of mapDispatchToProps. If I use the full boilerplate format of mapDispatchToProps then the prop is passed.

What am I not seeing here?

1 Answers
Related