Function components cannot have string refs. But I'm in both function/class components

Viewed 19

I am seeing the error in the title when doing below

Component A (class based component):

getSpecificRef = (ref) => {
    this.savedRef = ref
}

<ComponentB getSpecificRef = {this.getSpecificRef} />

In Component B (Function Component)

const getSpecificRef = (ref) => {
   if(props.getSpecificRef) {
      props.getSpecificRef = ref
   }
}

(In return Statement)
<Component C values={getSpecificRef} />

In Component C (class based component)

<Form value={this.props.values />

This is inside a very large enterprise application so there's very little I can do in terms of changing the structure. Just trying to understand why and what I can do because the task of refactoring one of the component files to class/function is extreme at the moment.

0 Answers
Related