Skip to content

Web Chat throwing "Invalid Hook" error with React Hooks #2261

@tdurnford

Description

@tdurnford

Screenshots

image

Version

v4.5.0 built from master branch

Description

The development team recently bumped Web Chat's React dependency to v16.8.6 which introduces React Hooks to Web Chat. While working on a pull request for the typing indicator, I tried to use the useState and useEffect hooks in a component; however, Web Chat threw an "Invalid Hook" Error. I created a really simple component to double check it wasn't my logic, but Web Chat still threw the error.

To Reproduce

Add a simple component with React Hooks to Web Chat.

const TypingIndicator = () => {
  const [item] = useState('Hello, World!');
  return <div>{ item }</div>
}

Expected behavior

React Hooks should not cause Web Chat to crash.

[Bug]

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or an unintended behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions