I think we should move this snippet in componentWillMount or componentDidMount, lifecycle function…
Bouba (Boubacar S. Barry)

Any specific reason that you are willing to perform the subscription in a life cycle method? I think having it in the constructor allows the subscription lifecycle to take place as soon as possible since the constructor runs before any of the other things happen.

But yeah, I can see myself using componentDidMount life cycle method based on my solution. For example, if I am doing SSR. However, I don’t think componentWillMount is a good place. It is better to use constructor in that scenario.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.