Say I've got this component:
const Awesome = props => <div>awesomeness</div>;
Awesome.propTypes = {
title: PropTypes.string
};
It really doesn't matter.
I export this component wrapped in the track decorator:
export default track(() => ({
eventCategory: 'Awesome',
eventAction: 'Awesome action',
}))(Awesome);
Then, in a different component, let's call it Tremendous, I'm trying to inherit propTypes from Awesome into Tremendous.
const Tremendous = ({awesomeProps}) => <Awesome {...awesomeProps} />;
Tremendous.propTypes = {
awesomeProps: PropTypes.shape(Awesome.propTypes)
};
This won't work. In the above example, Awesome.propTypes is undefined. The reason for this is the track decorator. Had I not used it, I could inherit the propTypes like above, just fine.
TL;DR: The track decorator should copy/preserve propTypes and defaultProps.
Versions:
React 16.13.1
React-tracking 7.1.0
Node.js 12.18
Say I've got this component:
It really doesn't matter.
I export this component wrapped in the
trackdecorator:Then, in a different component, let's call it Tremendous, I'm trying to inherit propTypes from Awesome into Tremendous.
This won't work. In the above example,
Awesome.propTypesis undefined. The reason for this is thetrackdecorator. Had I not used it, I could inherit the propTypes like above, just fine.TL;DR: The
trackdecorator should copy/preserve propTypes and defaultProps.Versions:
React 16.13.1
React-tracking 7.1.0
Node.js 12.18