Просмотр исходного кода

change callback function to arrow function to remove bind(this).

Yuto Iwata 7 лет назад
Родитель
Сommit
2076400000
1 измененных файлов с 1 добавлено и 3 удалено
  1. 1 3
      src/client/js/components/InstallerForm.js

+ 1 - 3
src/client/js/components/InstallerForm.js

@@ -22,9 +22,7 @@ class InstallerForm extends React.Component {
       responseType: 'json'
     });
     axios.get('/_api/check_username', {params: {username: event.target.value}})
-      .then(function(res) {
-        this.setState({ isValidUserName: res.data.valid });
-      }.bind(this));
+      .then((res) => this.setState({ isValidUserName: res.data.valid }));
   }
 
   changeLanguage(locale) {