title: ReactJS autocomplete from React Bootstrap not working
body: <p>I'm trying to build an autocomplete search field, using <a href="https://react-bootstrap.github.io/components/forms/#form-control-props" rel="noreferrer">this form component</a> from React Bootstrap, which is rendered as a input by the browser.</p>
  <p>Here's what I did in my React component:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;FormControl
   id=&quot;frenchToEnglishInput&quot;
   placeholder=&quot;type a word...&quot;
   aria-label=&quot;Recipient's username&quot;
   autocomplete=&quot;on&quot;
   data={frenchToEnglishWords}
   onChange={this.fetchFrenchToEnglish}
   renderItem = {item =&gt; {
     return (
       &lt;div&gt;
         {item}
       &lt;/div&gt;
     );
   }}
  /&gt;
  </code></pre>
  <p>the <code>frenchToEnglishWords</code> array is declared outside the component as a <code>var</code>, as I intend to update it as I type some value into the input field.</p>
  <p>Now here is the function that triggers the <code>onChange</code> event :</p>
  <pre class="lang-js prettyprint-override"><code>fetchFrenchToEnglish = async () =&gt; {
      if(document.getElementById(&quot;frenchToEnglishInput&quot;).value!==''){
  
        axios.get(dictionaryURIs.english.French_English+&quot;&quot;+document.getElementById(&quot;frenchToEnglishInput&quot;).value)
        .then(response =&gt; {
            frenchToEnglishWords = response.data
        })
  
      }
    }
  </code></pre>
  <p>The request is made from MongoDb, after setting up an autocomplete index on a collection, but this part works fine.</p>
  <p>My question is, why is the only &quot;autocomplete&quot; I'm getting is the one made of the previous words I've typed ?</p>
  <p><a href="https://i.stack.imgur.com/797aa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/797aa.png" alt="input wrong autocomplete" /></a></p>
  <p>Or maybe the array I'm using as input data must be a <code>const</code> (as I've seen in many examples) and not a <code>var</code> ?
  When I do type in some word, I do not get any autosuggestion from the <code>frenchToEnglishWords</code>, which is being updated from the DB.</p>