Skip to content

Refs don't get attached to a component inside Suspense  #14642

Closed
@vaclav-zeman

Description

@vaclav-zeman

Do you want to request a feature or report a bug?
bug

What is the current behavior?
When you want to attach ref to a component that is lazy loaded and is rendered inside <Suspense>, the ref is just always null.

I've tried both React.createRef and normal ref={console.log} callback but it's just never called.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React.:
https://codesandbox.io/s/1yom049zkj

What is the expected behavior?
Attaching ref successfully

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
16.7.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions