Skip to content

Commit

Permalink
refactor: unused bind on arrow function
Browse files Browse the repository at this point in the history
  • Loading branch information
mcataford committed Mar 1, 2020
1 parent e7793f4 commit 9355588
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/components/CountryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import utils from './utils';

import FlagBox from './FlagBox';

function partial(fn, ...args) {
return fn.bind(fn, ...args);
}

export default class CountryList extends Component {
static propTypes = {
setFlag: PropTypes.func,
Expand Down Expand Up @@ -66,10 +62,6 @@ export default class CountryList extends Component {
this.listElement.setAttribute('class', 'country-list');
};

setFlag = iso2 => {
this.props.setFlag(iso2);
};

appendListItem = (countries, isPreferred = false) => {
const preferredCountriesCount = this.props.preferredCountries.length;

Expand All @@ -93,7 +85,7 @@ export default class CountryList extends Component {
isoCode={country.iso2}
name={country.name}
onMouseOver={onMouseOverOrFocus}
onClick={partial(this.setFlag, country.iso2)}
onClick={() => this.props.setFlag(country.iso2)}
onFocus={onMouseOverOrFocus}
flagRef={selectedFlag => {
this.selectedFlag = selectedFlag;
Expand All @@ -117,8 +109,7 @@ export default class CountryList extends Component {

render() {
const { preferredCountries, countries, showDropdown } = this.props;
const className = classNames({
'country-list': true,
const className = classNames('country-list', {
hide: !showDropdown,
});

Expand Down

0 comments on commit 9355588

Please sign in to comment.