Skip to content

ref callback argument is null #8359

@screendriver

Description

@screendriver

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

A bug 🐛

What is the current behavior?

The ref callback gets called with null as argument instead of an instance of the component. This only occurs when you write the component name starting with an uppercase character (PascalCase). If you write the component starting with a lowercase character (camelCase) everything works as expected.

This jsfiddle demonstrates how you get a null argument: https://jsfiddle.net/1v9vk4zb/
And this demonstrates how you get a correct reference: https://jsfiddle.net/a0d0owru/

As you can see I just renamed Button to lowercaseButton.

What is the expected behavior?

It should always pass the component instance as argument to the callback.

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

This occurs in v15.4.0 and v15.3.1. I didn't tested any other versions.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions