React-autosuggest: Turn off spellcheck on input field

Created on 3 Mar 2016  路  5Comments  路  Source: moroshko/react-autosuggest

Is there a way I can control attributes on input field?

Most helpful comment

@sushant711 Are you sure that adding spellCheck: false (note the capital C) to inputProps doesn't work? spellCheck is listed in the supported attributes in the docs.

All 5 comments

Anything passed into inputProps will be propagated to the input element.

Actually that didn't worked.
Instead this worked perfectl,

saveInputRef: function(autosuggest) {
   this.inputRef = autosuggest && autosuggest.input;
   if (this.inputRef) this.inputRef.spellcheck = false;
}

<Autosuggest ...... ref={this.saveInputRef} />

@sushant711 Are you sure that adding spellCheck: false (note the capital C) to inputProps doesn't work? spellCheck is listed in the supported attributes in the docs.

@moroshko Ah, capital C worked. I should have referred documentation properly. My bad. Thanks for a clear simple solution and thanks for building this awesome library. I tried react-select and many more. None of them had a satisfactory API contract. react-autosuggest has a very minimal yet sufficient contract :)

Thanks @sushant711 :+1:

Was this page helpful?
0 / 5 - 0 ratings