Accepted answer

If the setTimeout feels hacky (a view I tend to agree with), you could use the transitionend event instead.

The transitionend event is fired when a CSS transition has completed. In the case where a transition is removed before completion, such as if the transition-property is removed or display is set to "none", then the event will not be generated.

Aside from that I don't really see anything wrong with your approach


Use Flux

You can add a listener to the websocket in the app launcher (typically App.js / index.js or something similar). When data comes in the websocket, just call the Flux Action that triggers a store update. The React component can have a store listener and know when to update component state & re-render.

Related Query

More Query from same tag