basic frontend demo with react and redux
This commit is contained in:
25
frontend-react/src/components/widgets/SelectWrapper.js
Normal file
25
frontend-react/src/components/widgets/SelectWrapper.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
import Select from "react-select";
|
||||
import { optionchangewrapper } from "utils/optionchangewrapper";
|
||||
|
||||
class SelectWrapper extends React.Component {
|
||||
handleOptionChange = selectedOption => {
|
||||
const { onOptionChanged, optionName } = this.props;
|
||||
onOptionChanged({
|
||||
optionName,
|
||||
optionValue: selectedOption
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
let { value, options, choices } = this.props;
|
||||
return (
|
||||
<Select
|
||||
value={options[value]}
|
||||
onChange={this.handleOptionChange}
|
||||
options={choices}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default optionchangewrapper(SelectWrapper);
|
||||
Reference in New Issue
Block a user