Skip to content

Instantly share code, notes, and snippets.

@jamesreggio
Last active August 27, 2018 21:54
Show Gist options
  • Save jamesreggio/f595b626b984e86658d0d2ea10a8ac99 to your computer and use it in GitHub Desktop.
Save jamesreggio/f595b626b984e86658d0d2ea10a8ac99 to your computer and use it in GitHub Desktop.
Log output showing the broken interaction between React.forwardRef and hoist-non-react-statics
// Even though CurrentEpisodeWaveform is a component class that
// properly composes the three HOCs with Waveform, its static
// properties make it appear like a `forwardRef` component type.
const CurrentEpisodeWaveform = compose(
withCurrentEpisode,
withEpisodeAmplitudes,
withSize
)(Waveform);
console.log(typeof CurrentEpisodeWaveform);
// => 'function'
console.log(Object.keys(CurrentEpisodeWaveform));
// => [
// 'MIN_AMPLITUDE',
// 'MAX_AMPLITUDE',
// '$$typeof', <= These are bad!
// 'render', <= They're hoisted all the way from withSize.
// ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment