Skip to content

Feature Request -- add non hook methods #6

Answered by apenab
gravitymedianet asked this question in Q&A
Discussion options

You must be logged in to vote

@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)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by apenab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4 on April 04, 2021 17:34.