Open arendu-zz opened 5 years ago
You have to remove className
from the inputProps.
Like this:
const renderInputComponent = inputProps => {
delete inputProps.className;
return (
<div>
<input className={this.state.classes.join(' ')} {...inputProps}/>
</div>
);
};
Or you can add your classes into the inputProps.className
field if you still want to keep the theme
classes from Autosuggest.
Hi, I am trying to make an autosuggest component for a quiz activity. One of the requirements is to show when a selected suggestion is the correct answer or not. I want to show this by changing the
background-color
of the input field.I want to do this by adding and removing css classes to the input. I understand the default classname is
react-autosuggest__input
. Is there a way to dynamically add/remove new classes? I want to add awrong
class or acorrect
class depending on the answer selected.I am trying to do this via
renderInputComponent
feature kind of like this (but it does not work):Any suggestion on how to accomplish this?