Create a new variable to store the entire transcript like this
const [msg, setMsg] = useState("")
Next, whenever the recognition.onresult
method is called, you can append the new transcript to what is being displayed on the browser like this
setMsg(msg + " " + transcript)
Now what you have done is set the transcript in the react component state.
Last step is to print it in the brower.
Just add a line in the return object like this
<h1>{msg}</h1>
Please don't flame me if my solution isn't what you are looking for thanks
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…