react-autosuggest icon indicating copy to clipboard operation
react-autosuggest copied to clipboard

Autowhatever is changing an uncontrolled input of type text to be controlled

Open piotrfalba opened this issue 10 years ago • 3 comments

Autowhatever is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components

piotrfalba avatar Jun 09 '16 12:06 piotrfalba

I'm getting the same error. This happens when I choose a suggestion from the list of suggestions.

lropero avatar Jun 21 '16 01:06 lropero

I found a solution for this. I added a typeof check within the onChange method (inputProps) to prevent state.value from being 'undefined' (which seems to cause this error):

handleChange(event) {
    const value = event.target.value;
    if(typeof value !== 'undefined') {
        this.setState({
            value
        });
    }
}

lropero avatar Jun 21 '16 07:06 lropero

Sounds like an issue with Autowhatever.

Could you please make sure the issue is reproducible in the latest version of react-autowhatever, and create an issue there?

moroshko avatar Jul 21 '16 09:07 moroshko