I've just upgraded to the latest version and one of issues the came up was with react/no-string-refs.
The docs here suggest the following:
<Foo
ref={(ref) => this.myRef = ref}
/>
This causes a no-return-assign error. I'm not sure if it's possible but should this rule be relaxed in this case?
One way around it is wrapping the assignment in parenthesis:
<Foo
ref={ref => (this.myRef = ref)}
/>
But that seems a bit off. Any suggestions?
You want an arrow function that doesn't have a return value - like (ref) => { this.ref = ref; }. Does that solve the issue?
thanks @ljharb
thanks @ljharb
Most helpful comment
You want an arrow function that doesn't have a return value - like
(ref) => { this.ref = ref; }. Does that solve the issue?