-
Notifications
You must be signed in to change notification settings - Fork 50.2k
Closed
Labels
Component: ReactIsResolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityType: Feature Request
Description
What is the current behavior?
ReactIs.typeOf currently only works for element types, it does not allow you to pass a raw Component or ForwardRef to know the type.
The use case for this is in hoist-non-react-statics I now need a special cases for ForwardRefs. To do this, I will need to know the type of the source and target components, but currently I would need to turn them into elements first.
All of the ReactIs.is* functions also have this issue since they use the typeOf function internally.
const ForwardComponent = React.forwardRef(() => {});
ReactIs.typeOf(ForwardComponent); // undefined
ReactIs.typeOf(React.createElement(ForwardComponent)); // Symbol(react.forward_ref)What is the expected behavior?
Ideally I could pass in just the Component and get the type of it:
ReactIs.typeOf(ForwardComponent) // Symbol(react.forward_ref)Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
ReactIs@16.3.2
Cap32, petegleeson, mweststrate, eps1lon, danielkcz and 1 more
Metadata
Metadata
Assignees
Labels
Component: ReactIsResolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityType: Feature Request