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
{{ message }}
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
In the tutorial, the room subscription hooks such as onUserCameOnline or onUserJoined are set up so that they invoke this.forceUpdate(). However, according to the React Docs, using forceUpdate() is discouraged. Are there other ways in which I can manage room subscription hooks other than using forceUpdate()?
The text was updated successfully, but these errors were encountered:
In the onUserCameOnline and onUserJoined hooks, you can update your state. For example,
onUserCameOnline: user => {
this.setState({
users: [...this.state.users, user]
}}
}
Thing is, Chatkit mutates currentRoom.users for us so you don't actually have to track users yourself.
You could do:
onUserCameOnline: user => {
this.setState({
users: this.currentRoom.users
}}
}
And that wold be okay too!
In my opinion, there is no practical downside to using forceUpdate here but again, this is a demo. In a more complicated app, I am not sure what the implications would be.
Thanks! I actually have two more questions. I am not sure if this is the right place to ask questions, but here they are:
After following the tutorial, I am making my own version of the app and I plan to deploy it to heroku. I want to deploy both the express server and the react client simultaneously. Do you know of any resources that may guide me through this process?
Instead of exposing the key for the Chatkit API on public repo, I plan to conceal any sensitive info in env variables. I am hiding the Chakit secret key for sure, but do I also need to hide the instance locator key?
Thanks for reading! You guys are awesome :)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In the tutorial, the room subscription hooks such as
onUserCameOnline
oronUserJoined
are set up so that they invokethis.forceUpdate()
. However, according to the React Docs, usingforceUpdate()
is discouraged. Are there other ways in which I can manage room subscription hooks other than usingforceUpdate()
?The text was updated successfully, but these errors were encountered: