Feature Request -- add non hook methods #6
Answered
by
apenab
gravitymedianet
asked this question in
Q&A
-
I am using this plugin in a mixed environment where I have both class components and function components. Is there a way to import the dymoCheckService and dymoRequestBuilder into class components? Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
apenab
Apr 4, 2021
Replies: 1 comment
-
@gravitymedianet you can use a HOC like this: import React from "react";
import {useDymoCheckService} from "react-dymo-hooks";
export function withDymoService(WrappedComponent) {
return function (props) {
const statusDymoService = useDymoCheckService();
return <WrappedComponent {...props} statusDymoService={statusDymoService} />;
};
}
class SomeClass extends React.Component{
render(){
const status = this.props.statusDymoService;
return;
}
}
export withDymoService(SomeClass) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
apenab
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@gravitymedianet you can use a HOC like this: