react-form-with-constraints icon indicating copy to clipboard operation
react-form-with-constraints copied to clipboard

Use React.createRef() instead of callback ref

Open tkrotoff opened this issue 5 years ago • 0 comments

See Introduction to Refs in React 16.3

Prior to React v16.3 the callback ref were the preferred way to create and use refs. [...] If you use an inline callback function for your ref a new function is created for every re-render. This is the case with any arrow function inside the render method. The inline callback function will also be called twice during updates. [...] the first call produces a null value before the element is return on the second call.

tkrotoff avatar Aug 08 '18 12:08 tkrotoff