Skip to content

Commit

Permalink
Refactored Async.js
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri-sakharov committed Dec 22, 2017
1 parent f7a17a6 commit 4fa40cb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Async.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Select from './Select';

import stripDiacritics from './utils/stripDiacritics';

const propTypes = {
autoload: PropTypes.bool.isRequired, // automatically call the `loadOptions` prop on-mount; defaults to true
cache: PropTypes.any, // object to use to cache results; set to null/false to disable caching
Expand Down Expand Up @@ -34,6 +36,8 @@ const propTypes = {

const defaultCache = {};

const defaultChildren = props => <Select {...props} />;

const defaultProps = {
autoload: true,
cache: defaultCache,
Expand Down Expand Up @@ -183,7 +187,7 @@ export default class Async extends Component {
}

render () {
const { children, loadingPlaceholder, multi, onChange, placeholder, value } = this.props;
const { children, loadingPlaceholder, placeholder } = this.props;
const { isLoading, options } = this.state;

const props = {
Expand All @@ -204,9 +208,3 @@ export default class Async extends Component {

Async.propTypes = propTypes;
Async.defaultProps = defaultProps;

function defaultChildren (props) {
return (
<Select {...props} />
);
}

0 comments on commit 4fa40cb

Please sign in to comment.