eslint-plugin-immutable icon indicating copy to clipboard operation
eslint-plugin-immutable copied to clipboard

Refs and Functional Components

Open kopach opened this issue 6 years ago • 2 comments

Hi. I very like this plugin, but I got stack while trying to make immutable getting of reference on native element.

Official react documentation says You may not use the ref attribute on functional components

Any idea hot wo accomplish that immutable way? Or if it's impossible, I would like to have an option in this plugin to be allow such cases. Any chance for that?

kopach avatar Apr 10 '18 20:04 kopach

Functional components aren't the same as native/DOM components; you can still use ref on a DOM component. Why do you need one on an SFC?

ljharb avatar Apr 10 '18 21:04 ljharb

My point was, that I can get ref only within a class by assigning it to some property of this or to some let variable. In both cases - it's not allowed by plugin. I need ref to pass an element to en external lib.

kopach avatar Apr 10 '18 21:04 kopach