ReactJs / Javascript - Can a HOC read the parameter component's props? -
i have higher order component receives component parameter:
hoc
export default function hoc(comp) { return class extends component { dosomething() { const temp = // comp's clientid prop??? } ........ } }
sub component
@hoc export default class subcomponent extends component { ..... static proptypes = { clientid: proptypes.string.isrequired }; ....... }
question:
is possible in scenario above hoc aware of subcomponent's clientid property in arguements , if so, how can make hoc aware of dosomething function?
since it's hoc receives props (or rather component function returns), can access them this.props
:
const temp = this.props.clientid;
Comments
Post a Comment