Can't make the react component work
# 🤝help
b
Hello guys, I have a problem with the react component 😕, I copied this code from the documentation and I put my clientId:
Copy code
import "./style.css"
import theme from "./theme.json"
 
import { MessageList, Container, WebchatProvider, useClient } from '@botpress/webchat'
 
const App = () => {
  const client = useClient({ clientId: '453254325-54325-435-345-345534253' })
 
  return (
    <WebchatProvider client={client} theme={theme}>
      <Container>
        <MessageList />
      </Container>
    </WebchatProvider>
  )
}
I put this in my react app but my bot doesn't seem to load, I have this default bot instead, and when I try to enter a message I have this error: "Unexpected state:disconnected" has anyone managed to make the react component work ? Any help would really be appreciated ! https://cdn.discordapp.com/attachments/1243561164340727809/1243561164756090972/image.png?ex=6651ec15&is=66509a95&hm=8e1f6e8c6b50f36ff62240994523378824158fcaa514b0dd46707212bd778858& https://cdn.discordapp.com/attachments/1243561164340727809/1243561165049696467/image.png?ex=6651ec15&is=66509a95&hm=14007f47d43fcc3c46302c2c0669dbc5314680965bfbea5abb05acde4121aef4&
f
Hey there, I haven't gotten around to this topic yet, but I would love to explore it a bit more, hopefully later today. Until then I would advise you to not share your clientID publicly. I don't think it can be misused that much, but just in case.
b
ok thanks but don't worry in the code I sent it's the cliendId from the documentation !
f
Ah okay good
f
did you find the solution? the same happens to me
f
Didn't get around to it before the exams started.
f
ok Decay thanks, Some help would be good to implement the new version in react because it would save me a lot of time
b
thanks a lot, that worked! I also had to replace the useClient function by getClient
101 Views