Tell me, please, how to save the selected value of option
, at me in a select
it is saved only first value (which is One
).How to save the selected value in select
?
Here is the code (this is final-form
):
export const SelectFilter = props => {
const { onFilterChange, filterOptions } = props;
return (
<Form
render={({ handleSubmit }) => (
<form onSubmit={handleSubmit}>
<div>
<label htmlFor="section">Select:</label>
<Field
id="section"
name="section"
component="select"
onChange={e => onFilterChange(e)}
defaultValue={filterOptions.section}
>
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
</Field>
</div>
</form>
)}
/>
);
};