You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Side effects in React should be called after component is rendered. Otherwise render performance is affected.
Based on my profiling calling an update takes tens of miliseconds.
In version 1 Intercom('update') should be called in componentDidMount().
In version 2 Intercom('update') should be called in useEffect()
The text was updated successfully, but these errors were encountered:
Poky85
changed the title
Calls to Intercom('update') should be used in effect not in render method
Calls to Intercom('update') should be placed in effect not in render method
Sep 11, 2019
When
ReactIntercom
props changes,Intercom('update')
method gets called with new values.In
ReactIntercom
v1 update method is called incomponentWillReceiveProps
lifecycle method.https://github.com/nhagen/react-intercom/blob/master/src/index.js#L59
In
ReactIntercom
v2 update method is called directly in render.https://github.com/nhagen/react-intercom/blob/2.0/src/react-intercom.ts#L69
Side effects in React should be called after component is rendered. Otherwise render performance is affected.
Based on my profiling calling an update takes tens of miliseconds.
In version 1
Intercom('update')
should be called incomponentDidMount()
.In version 2
Intercom('update')
should be called inuseEffect()
The text was updated successfully, but these errors were encountered: