Skip to content

Improve warnings about refs on functional components during runtime and in docs #7267

@pke

Description

@pke

I had trouble to get ref working on one of my composite components.

This inline ref function

<MyComp ref={element => this.listElement = element}/>

will always be called with element===null on mount and unmount the like. Thats because MyComp is a stateless/functional component.

react should print a warning if one tries to use ref with stateless components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions