Skip to content

How to create HOC for in built react component? #3792

Description

@VeenaMalali13

I am totally new to HOC.

I have one custom component where I am calling react in built component.
e.g suppose "ABC" is my custom component and "XYZ" react npm package installed in my project And I am importing "XYZ" in class "ABC".

Whatever I am passing to "XYZ" as props, I need to use it in custom "ABC" component. Is it possible with HOC??
e.g
...
import XYZ from "react npm package";
import ActionProvider from './ActionProvider';

class ABC extends React.Component{

 <XYZ  actionProvider={ActionProvider} />

}
export default ABC;
........
ActionProvider is simple js file(it is not a react component). I need to call 1 method from action provider in ABC. But not able to call. Making that method static will not solve my problem because I need to use this object the method which I want to call.

Help me out if anyone knows the solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions