You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
579 B
25 lines
579 B
import { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
|
|
export class Option extends Component {
|
|
render() {
|
|
const className = ['option'];
|
|
console.log(this.props.selected + ' ' + this.props.index)
|
|
|
|
if (this.props.selected === this.props.index) {
|
|
className.push('selected');
|
|
}
|
|
|
|
return (
|
|
<div className={className.join(' ')}>{this.props.value}</div>
|
|
);
|
|
};
|
|
};
|
|
|
|
const select = (state) => {
|
|
return {
|
|
selected: state.options
|
|
};
|
|
};
|
|
|
|
export default connect(select)(Option);
|
|
|