Skip to content

Use React.createRef() instead of callback ref #31

Open
@tkrotoff

Description

@tkrotoff

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions