From 59b3d94fdf2a06b5d07db0d0cee3461eded4579a Mon Sep 17 00:00:00 2001 From: Ayush Kumar Sinha Date: Fri, 28 Jun 2019 00:56:20 +0530 Subject: [PATCH] removing unnecessary bind and using arrow function throughout --- client/src/components/Branches.js | 11 ++++------- client/src/components/Commits.js | 8 +++----- client/src/components/PullState.js | 11 ++++------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/client/src/components/Branches.js b/client/src/components/Branches.js index d06415f..c7e6625 100644 --- a/client/src/components/Branches.js +++ b/client/src/components/Branches.js @@ -16,9 +16,6 @@ import { class Branches extends React.Component { constructor(props) { super(props); - - this.toggle = this.toggle.bind(this); - this.Stylemodif = this.Stylemodif.bind(this); this.state = { dropdownOpen: false }; @@ -40,12 +37,12 @@ class Branches extends React.Component { ); }; - toggle() { + toggle = () => { this.setState(prevState => ({ dropdownOpen: !prevState.dropdownOpen })); - } - Stylemodif(data) { + }; + Stylemodif = data => { return { ...data, styles: { @@ -54,7 +51,7 @@ class Branches extends React.Component { maxHeight: 500 } }; - } + }; render() { return ( diff --git a/client/src/components/Commits.js b/client/src/components/Commits.js index 6225bfa..3d6b747 100644 --- a/client/src/components/Commits.js +++ b/client/src/components/Commits.js @@ -99,11 +99,9 @@ class Commits extends React.Component {

Latest Commits

{this.props.isLoading.load ? (
-
- Fetching latest Commits of {this.props.branch} - for you... - -
+ Fetching latest Commits of {this.props.branch} + for you... +
) : (
diff --git a/client/src/components/PullState.js b/client/src/components/PullState.js index 7833424..7641737 100644 --- a/client/src/components/PullState.js +++ b/client/src/components/PullState.js @@ -11,9 +11,6 @@ import { currState, loadPulls } from '../redux/actions'; class pullState extends React.Component { constructor(props) { super(props); - - this.toggle = this.toggle.bind(this); - this.Stylemodif = this.Stylemodif.bind(this); this.state = { dropdownOpen: false }; @@ -32,12 +29,12 @@ class pullState extends React.Component { ); }; - toggle() { + toggle = () => { this.setState(prevState => ({ dropdownOpen: !prevState.dropdownOpen })); - } - Stylemodif(data) { + }; + Stylemodif = data => { return { ...data, styles: { @@ -46,7 +43,7 @@ class pullState extends React.Component { maxHeight: 500 } }; - } + }; render() { return (