From 39c183301c46154a05f1d5b7ee5aa53fdcde1a5f Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Fri, 21 Feb 2020 20:55:23 -0500 Subject: [PATCH] removes unnecessary constructor in EuiFormRow --- src/components/form/form_row/form_row.tsx | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/components/form/form_row/form_row.tsx b/src/components/form/form_row/form_row.tsx index 7e22ef4e4b52..7e7d80cd3783 100644 --- a/src/components/form/form_row/form_row.tsx +++ b/src/components/form/form_row/form_row.tsx @@ -104,19 +104,12 @@ export class EuiFormRow extends Component { hasChildLabel: true, }; - constructor(props: EuiFormRowProps) { - super(props); - - this.state = { - isFocused: false, - id: props.id || makeId(), - }; - - this.onFocus = this.onFocus.bind(this); - this.onBlur = this.onBlur.bind(this); - } + state: EuiFormRowState = { + isFocused: false, + id: this.props.id || makeId(), + }; - onFocus(...args: any[]) { + onFocus = (...args: any[]) => { // Doing this to allow onFocus to be called correctly from the child input element as this component overrides it const onChildFocus = get(this.props, 'children.props.onFocus'); if (onChildFocus) { @@ -126,9 +119,9 @@ export class EuiFormRow extends Component { this.setState({ isFocused: true, }); - } + }; - onBlur(...args: any[]) { + onBlur = (...args: any[]) => { // Doing this to allow onBlur to be called correctly from the child input element as this component overrides it const onChildBlur = get(this.props, 'children.props.onBlur'); if (onChildBlur) { @@ -138,7 +131,7 @@ export class EuiFormRow extends Component { this.setState({ isFocused: false, }); - } + }; render() { const {