I have a component where I try to compose (imported from "compose-function" library) as below;
export function MyRoute() {
let MyGridWithData = compose(
withRouter,
withTranslation("translations"),
withMyApi()
)(MyGrid);
return <MyGridWithData />;
}
However, for some reason, I am seeing the below error;
TypeError: Object(...) is not a function
The error is pointed on the line ; let MyGridWithData = compose(...)
Also, while withRouter & withTranslation are standard hooks, withMyApi is defined as below (it is a HOF basically);
export function withMyApi() {
// Extra function wrapper
return function(WrappedComponent) {
class MyApiUrls extends React.Component {
constructor(props) {
super(props);
}
render() {
return <WrappedComponent api={this.api} {...this.props} />;
}
}
return MyApiUrls;
};
}