title: How to make a error message display:none and display:block?
body: <p>I have a method that does not define ShowErrorWarning in the render area. I need to use state. But how can I get this function valid?</p>
  
  <p>I already tried to use the error-message as a function ShowErrorMessage above the class. But then I can not include state.</p>
  
  <pre><code>function ShowWarning() {
  
  let error = this.props.warningError.error;   
  
      if (error === "") {
          this.setState({
              ...this.state,
              errorStyle: {
                  display: 'none'
              },
              warningMessage: ''
          });
      } else {
          this.setState({
              ...this.state,
              errorStyle: {
                  display: 'block'
              },
              warningMessage: this.props.warningError.message
          }); 
      }
  
  }
  </code></pre>
  
  <p>The error message will show as a separate component when i get an error from the API call. This is stored in this.props.warningError.error.</p>