This is what my mapStateToProps looks like.
const mapStateToProps = (state): StateProps => {
let status = false;
if (state.productsPage.currentProduct) {
if (state.productsPage.currentProduct.status === "ACTIVE") {
status = true;
}
}
return {
showModal: state.productsPage.showModal,
currentProduct: state.productsPage.currentProduct,
isLoading: state.status.loading.PRODUCTS_EDIT,
initialValues: {
name: state.productsPage.currentProduct ? state.productsPage.currentProduct.name : "",
status,
},
};
};
Here is the shape of StateProps
type StateProps = {
showModal: boolean,
currentProduct: Object,
isLoading: boolean,
initialValues: {
name: string,
status: boolean,
}
}
This is my usage of connect.
const connected = connect<React$StatelessFunctionalComponent<any>, StateProps>(mapStateToProps, mapDispatchToProps);
This produces the following error, and I have no idea what it means or how to go about solving it.
[flow] Cannot call
connectbecause propertycurrentProductis missing inReact.StatelessFunctionalComponent[1] in the indexer property's key of type argumentST. (References: [1])