title: How can I update img using state change in react with select option?
body: <p>Hello I am trying to update selected language image from select options. My problem is when I update my state selecting new flag it doesnt update image but updates image alt value.
  <a href="https://i.stack.imgur.com/eF6I0.png" rel="nofollow noreferrer">Here is my current siuation</a>
  Thanks
  What I made here:</p>
  <pre><code>import unitedkingdom from '../assets/flags/uk.png';
  import belgium from '../assets/flags/icons8-belgium-48.png';
  import croatia from '../assets/flags/icons8-croatia-48.png';
  import czechrepublic from '../assets/flags/icons8-czech-republic-48.png';
  import bulgaria from '../assets/flags/icons8-bulgaria-48.png';
  export const CountryFlags = () =&gt; {
      const { selectedLanguage, setSelectedLanguage } = useContext(AppContext);
      const { Option } = Select;
  
      return &lt;&gt;{selectedLanguage &amp;&amp; &lt;img className=&quot;currentlySelectedLanguage&quot; src={selectedLanguage} alt={selectedLanguage} /&gt;}
          &lt;Select defaultValue='Lang' onChange={(e) =&gt; setSelectedLanguage(e)}&gt;
              &lt;Option value=&quot;unitedkingdom&quot;&gt;&lt;img className=&quot;availableLanguages&quot; src={unitedkingdom} alt=&quot;unitedkingdom&quot; /&gt;&lt;/Option&gt;
              &lt;Option value=&quot;belgium&quot;&gt;&lt;img className=&quot;availableLanguages&quot; src={belgium} alt=&quot;belgium&quot; /&gt;&lt;/Option&gt;
  
          &lt;/Select&gt;
      &lt;/&gt;
  }
  </code></pre>