What is proc and method in javascript?

I learned about HOC from this article , but I have not seen proc and method before. What are they related to?

 function refsHOC(WrappedComponent) { return class RefsHOC extends React.Component { proc(wrappedComponentInstance) { wrappedComponentInstance.method() } render() { const props = Object.assign({}, this.props, {ref: this.proc.bind(this)}) return <WrappedComponent {...this.props}/> } } } 
+5
source share
2 answers

this.proc relates to a method

 proc(wrappedComponentInstance) { wrappedComponentInstance.method() } 

wrappedComponentInstance.method() is just an example of how to call an arbitrary method on a wrapped component. The article says:

In the following example, we will look at how to access the instance methods and the WrappedComponent instance itself through refs


Thus, none of them has anything to do with the Reagent.

+6
source

I came across the same article and at first was confused. I split it into ES6 syntax to make things more understandable to users who are also confused.

 export default WrappedComponent => class extends Component { //Proc function that gets called proc = wrappedComponentInstance => { wrappedComponentInstance.method() } render() { const props = { ...this.props, ...{ ref: this.proc } } return <WrappedComponent {...props} /> } } 
+2
source

All Articles