title: displaying Flash message in react
body: <p>My task is to display flash message("successfully created") on clicking the submit button.[On clicking the submit button , data will be stored in the server]I have run this command npm i react-flash-message.</p>
  
  <pre><code>&lt;form onSubmit={this.handleSubmit}&gt;
     &lt;input type="submit" value="Submit" /&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>handleSubmit function:</p>
  
  <pre><code>  handleSubmit(event) {
       fetch('url', {
              method: 'POST',
              headers: {
                  'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                  name: this.state.name,
                  description: this.state.description
              })
          }).then(res =&gt; {
              return res.json()
          })
              .then(data =&gt; console.log(data))
              .then(() =&gt; {
                  window.location.reload(false)
                  /* return (
                       &lt;div&gt;
                          &lt;FlashMessage duration={5000}&gt;
                              &lt;strong&gt;I will disapper in 5 seconds!&lt;/strong&gt;
                         &lt;/FlashMessage&gt;
                     &lt;/div&gt;
                   ) */
              })
              /* window.flash('record has been created successfully!', 'success') */
  
              .catch(error =&gt; console.log('ERROR from create component'))
        }
       }
  </code></pre>
  
  <p>I have commented the code I have tried to display flash message. But it is not working. Please someone help me to display the flash message.</p>