title: React QRScan component
body: <p>I am using the react library &quot;qrscan&quot; to scan a barcode with my device camera. The problem is when I successfully scan my barcode and get a value, I cannot switch off the camera and therefore the QR continues being scanned and logs the value multiple times. How can I make it that the camera switches off and I only get the initial value from the scan?</p>
  <p>Example of code for scanning:</p>
  <pre><code>const [scanning, setScanning] = useState(false);
  const [scannerValue, setScannerValue] = useState('');
  
  const onFind = (value: string) =&gt; {
      setScannerValue(value);
      setScanning(false);
      console.log(value);
    };
  
  return (
    {scanning ? (
          &lt;QRScan onFind={onFind} /&gt;
        ) : (
          &lt;Fragment&gt;
            &lt;button onClick={() =&gt; setScanning(true)}&gt;Scan&lt;/button&gt;
            &lt;h4&gt;value: {scannerValue}&lt;/h4&gt;
          &lt;/Fragment&gt;
        )
    }
  )
  </code></pre>
  <p>For some reason the QRScan component keeps working even after <code>scanning</code> is false.</p>