Owen Ayres
Sep 1, 2018 · 1 min read

I found this article pretty awesome (thanks for it!), but discovered an issue with React 16. Your HOC makes use of the componentWillUnmount method. Well, in React 16, they made this async. Generally speaking, that’s fine, except in certain scenarios.

In my example I’m pubsubbing with this HOC on my header component, but it unsubscribes on route change and does not re-subscribe. This is due to the above change in React 16. You can find more here: https://github.com/facebook/react/issues/11106

The result is basically… my Header will never receive updates via its pubsub after a route change, even if it stays in exactly the same place.

Are you on 16? Have you bumped into this issue yet?

    Owen Ayres

    Written by

    JavaScript lover; React evangelist.