JamesBrill / react-speech-recognition

💬Speech recognition for your React app
https://webspeechrecognition.com/
MIT License
680 stars 121 forks source link

useSpeechRecognition() Error #178

Open svshiv opened 1 year ago

svshiv commented 1 year ago

I am getting error while using at useSpeechRecognition() function. Here is my error:

Uncaught TypeError: Cannot read properties of null (reading 'useState') at useState (react.development.js:1622:1) at useSpeechRecognition (SpeechRecognition.js:65:1) at App (App.js:11:1) at renderWithHooks (react-dom.development.js:16305:1) at mountIndeterminateComponent (react-dom.development.js:20074:1) at beginWork (react-dom.development.js:21587:1) at beginWork$1 (react-dom.development.js:27426:1) at performUnitOfWork (react-dom.development.js:26557:1) at workLoopSync (react-dom.development.js:26466:1) at renderRootSync (react-dom.development.js:26434:1)

Here is my code:

` import React from 'react'; import { useSpeechRecognition } from 'react-speech-recognition';

const App = () => { const { transcript, listening, resetTranscript, browserSupportsSpeechRecognition } = useSpeechRecognition();

return (

Hey I am being ready to listen

) }

export default App `

Please Help.

patrikniebur commented 1 year ago

It is difficult to help with more details about your environment. Can you specify versions and what do you use to render react? Like create react app or nextjs...

IhorKirei commented 1 month ago

I have the same issue: Babel and Webpack. At first I got "regeneratorRuntime is not defined" error, when it was solved - "Invalid hook call. Hooks can only be called inside of the body of a function component."