A React hook for browser speech-to-text that behaves like typing.
The Web Speech API (SpeechRecognition) gives you a stream of results, but wiring it into a text input is surprisingly fiddly:
- Interim results need to stream in so the user sees text appear as they speak — but they also need to be replaced when the recognizer refines them or finalizes them.
- Manual edits must be respected. If the user deletes text or types something, speech results shouldn't overwrite their changes.