react-qr-reader
react-qr-reader copied to clipboard
Improve useEffect: include dependencies and introduce additional effect which stops scanner when component unmounts
Current behavior
Updating properties (e.g. constraints) currently doesn't make the scanner behaviour adapt/reflect these updates. This is because these properties are not in the dependencies array of the useEffect within hooks.ts.
Proposal
Adding the missing dependencies to the useEffect and introducing an additional useEffect` which exclusively does the scanner stopping when the component unmounts.