{"size": 749, "ext": "js", "max_stars_repo_path": "src/components/SelectableList/SelectableList.js", "max_stars_repo_name": "gagamil/quizapp", "max_stars_repo_stars_event_min_datetime": "2018-06-21T06:37:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-19T20:31:02.000Z", "max_issues_repo_path": "src/components/SelectableList/SelectableList.js", "max_issues_repo_name": "gagamil/quizapp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/SelectableList/SelectableList.js", "max_forks_repo_name": "gagamil/quizapp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.40625, "max_line_length": 54, "alphanum_fraction": 0.6595460614}
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {List, makeSelectable} from 'material-ui/List';


let SelectableList = makeSelectable(List);
function wrapState(ComposedComponent) {
  return class SelectableList extends Component {
    static propTypes = {
      children: PropTypes.node.isRequired
    };

    handleRequestChange = (event, index) => {
      this.props.onChoiceSet(index);
    };

    render() {
      return (
        <ComposedComponent
          value={this.props.selectedIndex}
          onChange={this.handleRequestChange}
        >
          {this.props.children}
        </ComposedComponent>
      );
    }
  };
}

SelectableList = wrapState(SelectableList);

export default SelectableList;