question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem initializing WebChat in React 17.0.2

See original GitHub issue

Hi, I’ve just installed a new instance of WebChat in my new React app and I having some issues while initializing the ReactWebChat component.

Screenshots

Captura de pantalla 18 03 2022 a 08 54 16 a  m

Version

Here is my package.json file:

{
  "name": "src",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.26.1",
    "botframework-webchat": "^4.15.1",
    "http-proxy-middleware": "^2.0.4",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "sass": "^1.49.9",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "lint": "eslint .",
    "lint-fix": "eslint . --fix"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "eslint": "^8.11.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.29.4",
    "prettier": "^2.6.0"
  }
}

Describe the bug

My code in the App.js file is the default React creates with the create-react-app command with the imported WebChat.

import logo from 'assets/logo.svg'
import './App.scss'
import React, { useMemo } from 'react'
import ReactWebChat, { createDirectLine } from 'botframework-webchat'

const App = () => {
  const directLine = useMemo(
    () =>
      createDirectLine({
        token: 'XXXXXX'
      }),
    []
  )

  console.log(directLine)

  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
      <ReactWebChat directLine={directLine} />
    </div>
  )
}

export default App

Maybe the latest React version is not compatible with WebChat. This is the next thing I want to test out.

Steps to reproduce

Just open the webpage in localhost:3000.

Expected behavior

To not show an error in console and load WebChat.

Additional context

N/A

[Bug]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pablo-abellacommented, Apr 22, 2022

@compulim sorry for my delay but I have been stuck in other project and haven’t been able to return to this until this week.

I finally set up my repo with React 17.0.2 and WebChat 4.15.1 successfully, using your example as template. Thanks for all the help.

Best!

0reactions
mhmufteecommented, May 30, 2022

Hello @stevkan ,

I am having the same warning message but my webchat is rendered.

Will you fix this warning message in future?

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while installing botframework-webchat library in React
I am trying to create a new React Application using "botframework-webchat" library but I am getting the below error while running the ...
Read more >
ReactDOMClient – React
The react-dom/client package provides client-specific methods used for initializing an app on the client. Most of your components should not need to use...
Read more >
Migrate from Flex UI 1.x.x to 2.x.x | Twilio
Learn how to migrate your Twilio Flex account from UI version 1.x.x to UI version 2.x.x and what changes you may need to...
Read more >
test-cometchat-react-ui-kit - NPM Package Overview - Socket
The init() method initializes the settings required for CometChat. We suggest calling the init() method on app startup, preferably in the onCreate() method...
Read more >
Create a Secure Chat Application with Socket.IO and React
You should not receive any error messages but you also will not see ... This will create a new folder chat-client and initialize...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found