gaearon / ama

Ask me anything!
222 stars 5 forks source link

Google Analytics && extending setState in the class #151

Open CoachThomLamb opened 7 years ago

CoachThomLamb commented 7 years ago

I'm adding ReactGA to my app

I want to track state changes in a couple components.

I'm not using a store, just vanilla react setState.

I'm wondering what the best approach is.

I was thinking it might work well to add some "middleware" into react aka override the setState method .

I guess mostly I'm curious how do I subscribe to a state change - is it simplest to just use Redux, or is there something I'm missing ?