import getVersionTags from '../tags'; const React = window.React; class VersionPicker extends React.Component { constructor(props, context) { super(props, context); const version = props.version || 'local'; const versions = [version]; this.state = {versions}; } componentWillMount() { getVersionTags().then(tags => { let versions = tags.map(tag => tag.name.slice(1)); versions = [`local`, ...versions]; this.setState({versions}); }); } onChange = event => { this.props.onChange(event.target.value); }; render() { const {version, id, name} = this.props; const {versions} = this.state; return ( ); } } export default VersionPicker;