0

I'm not exactly sure why it's complaining as I'm pretty sure I've hooked everything up correctly, my component class is as follows:

type SubmitLinkPopupProps =
    SubmitLinkPopupStore.SubmitLinkPopupState
    & typeof SubmitLinkPopupStore.actionCreators
    & RouteComponentProps<{}>;

type SubmitLinkPopupAllProps = SubmitLinkPopupProps;// & InputSubmitLinkProps;

export class SubmitLinkPopup extends Component<SubmitLinkPopupAllProps, SubmitLinkPopupStore.SubmitLinkPopupState>
{

    constructor(props: SubmitLinkPopupAllProps) {
        super(props);
        this.SubmitLink = this.SubmitLink.bind(this);
        this.handleClose = this.handleClose.bind(this);
        this.handleTextFieldChange = this.handleTextFieldChange.bind(this);
    }

    handleOpen = () => {
       //...
    };

    handleClose = () => {
       //...
    };

    handleTextFieldChange(e) {
         //...
    };

    SubmitLink() {
        //...
    }

    public render() {
        //...
    }
}

export default connect((state: Store.RootState) => state.submitLinkPopup, SubmitLinkPopupStore.actionCreators)(SubmitLinkPopup);

and the reducer looks like this:

export const actionCreators = {
       //...
}

type KnownAction = RequestSubmitLinkAction | CancelSubmitLinkAction;


const submitLinkPopupReducer: Reducer<SubmitLinkPopupState> =
    (state: SubmitLinkPopupState, incomingAction: KnownAction) => {
          //...
    }

    export default submitLinkPopupReducer;

It's all hooked up in the store:

export interface RootState {
submitLinkPopup: SubmitLinkPopupState
}

const rootReducer = combineReducers({
submitLinkPopup: submitLinkPopupReducer,
})

const rootStore = createStore(
  rootReducer,
  applyMiddleware(middleware),
)

export default rootStore

This was working in a previous React-Redux project I was working in, I'm not sure what config might be missing which causes this issue.

1 Answer 1

1

Based on error message, the problem is RouteComponentProps<{}>; you need to change it to RouteComponentProps<any>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.