dillon1000/react

Commit

honor displayName set on ForwardRef if available (#13615)

* add failing test

* honor displayName set on ForwardRef if available

Since React.forwardRef returns a component object, some users
(including styled-components and react-native) are starting to
decorate them with various statics including displayName.

This adjusts React's various name-getters to honor this if set and
surface the name in warnings and hopefully DevTools.

* fix typing

* Refine later
Browse files
Changed paths3 files
First-parent comparison
M packages/react/src/ReactElementValidator.js ModifiedM packages/react/src/__tests__/forwardRef-test.js ModifiedM packages/shared/getComponentName.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…