ReactJS Calling an API and rendering results
Here is the code after refactor some changes that i think should be good to follow:


use let instead of var.
I have used style2 as a state as its changing.
Used arrow function instead of bind.
Prefer destructuring.



import React from "react";
import "./App.css";
import axios from "axios";

let Style = {
  marginRight: "22px"
};

const API_CALL = "xxx";

class SearchForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value: "",
      errorValue: "",
      countryCode: "",
      VATNumber: "",
      valid: false,
      name: "",
      address: "",
      isLoading: false,
      isSubmitted: false,
      Style2: { display: "none" }
    };
  }

  renderField() {
    return (
      &lt;form onSubmit={this.handleSubmit}&gt;
        &lt;label style={Style}&gt;Search VAT:&lt;/label&gt;
        &lt;input type="text" onChange={this.handleChange} style={Style} /&gt;
        &lt;input type="submit" value="Submit" /&gt;
      &lt;/form&gt;
    );
  }

  render() {
    const {
      Style2 = {},
      countryCode = "",
      VATNumber = "",
      valid = false,
      name = "",
      address = "",
      isLoading = false,
      isSubmitted = false,
      errorValue = ""
    } = this.state;
    return (
      &lt;div&gt;
        &lt;h5&gt;Reference: EE100247019&lt;/h5&gt;
        {this.renderField()}
        &lt;div id="results" /&gt;
        &lt;Loader loading={isLoading} /&gt;
        {isSubmitted &amp;&amp; (
          &lt;Result
            country={countryCode}
            number={VATNumber}
            name={name}
            address={address}
            error={errorValue}
            valid={valid}
            loading={isLoading}
            style={Style2}
          /&gt;
        )}
      &lt;/div&gt;
    );
  }

  handleChange = event =&gt; this.setState({ value: event.target.value.trim() });

  handleSubmit = event =&gt; {
    this.setState(({ Style2 }) =&gt; ({
      isLoading: true,
      isSubmitted: false,
      Style2: {
        ...Style2,
        listStyleType: "none",
        textAlign: "left",
        display: "block",
        border: "1px solid white",
        marginTop: "50px"
      }
    }));
    axios
      .get(API_CALL + this.state.value)
      .then(
        ({
          data: {
            CountryCode = "",
            VATNumber = "",
            Name = "",
            Address = "",
            Valid = false
          } = {}
        } = {}) =&gt;
          this.setState({
            countryCode: CountryCode,
            VATNumber: VATNumber,
            name: Name,
            address: Address,
            valid: Valid,
            isLoading: false,
            isSubmitted: true
          })
      )
      .catch(error =&gt;
        this.setState({
          valid: false,
          errorValue: this.state.value,
          isLoading: false,
          isSubmitted: true
        })
      );

    event.preventDefault();
  };
}


const Loader = ({ loading = false } = {}) =&gt;
  loading ? null : &lt;h6&gt; Loading ... &lt;/h6&gt;;

const Result = ({
  valid = false,
  error = "",
  style = {},
  country = "",
  number = "",
  name = "",
  address = ""
} = {}) =&gt; {
  if (!valid) {
    return (
      &lt;h5&gt;
        Invalid value "{error}"
        &lt;br /&gt; &lt;br /&gt;
        Please enter valid VAT Number
      &lt;/h5&gt;
    );
  } else {
    return (
      &lt;table style={style}&gt;
        &lt;tr&gt;
          &lt;td&gt;Country code: &lt;/td&gt;
          &lt;td&gt;{country}&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;VAT Number: &lt;/td&gt;
          &lt;td&gt;{number}&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Product name: &lt;/td&gt;
          &lt;td&gt;{name}&lt;/td&gt;
        &lt;/tr&gt;
        &lt;td&gt;Address: &lt;/td&gt;
        &lt;td&gt;{address} &lt;/td&gt;
      &lt;/table&gt;
    );
  }
}


export default SearchForm;