So, I have set
let recognition = new SpeechRecognition;
recognition.continuous = true;
recognition.interimResults = false;
recognition.lang = 'en-US';
this.setState({
recognition
});
console.log(this.state.recognition)
gives me the speechrecognition object.
because I shouldn't direct mutate the state with this.state.recognition.lang = 'ja-JP'
, I try to create a new object to set the recognition state to:
let newObject = {...this.state.recognition, lang: 'ja-JP'}
However, console.log(newObject)
returns { lang: 'ja-JP' }
and the rest of the properties are not cloned.
Is this a problem with the webkitspeechrecognition api and is there a workaround to getting it to work?