If I have a React component that requires some setup (e.g. for timers, or WebAudio API, etc), I'm having trouble deciding whether the initialization should go in constructor
or componentWillMount
. Is there any advantages or disadvantages to either one? It's not clear to me which one is the better place for this.
I Googled around a bit to see if anyone had discussed the differences between constructor
and componentWillMount
but I couldn't find anything.
EDIT: Redux and any asynchronous functions should not be part of the equation.