title: Update variable in React in class not extending component
body: <p>I am trying to wrap my head around ReactJS and I am stumped with an issue where I want to be able to update the value of a local variable and return the updated value. </p>
  
  <p>I've read about state and I've used that when working with React Components, however, this class is just defined as const and it doesn't extend React.Component. </p>
  
  <p>Is there a different way I should be defining setting the variable?</p>
  
  <p>Here is a simplified version of my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import React from 'react';
  
  const WelcomeForm = ({welcome}) =&gt; {
  
      var welcomeMsg = 'Test';
  
      DynamicContentApi.loadDynamicContent('welcome_test').then((response) =&gt; {
         // response.text has content
         welcomeMsg = response.text;
      }).catch(() =&gt; {
          welcomeMsg = '';
      });
  
      return (
                  &lt;p&gt;{welcomeMsg}&lt;/p&gt; // Returns 'Test'
      );
  };
  
  export default WelcomeForm;</code></pre>
  </div>
  </div>
  </p>