React QRCode Hook
👾
React hook for creating QR Code data urls
Install
yarn add react-qrcode-hook
or
npm install --save react-qrcode-hook
Usage
This hook returns a data URL which can be added as the source to an image. The
only parameter to the hook function is the string you want to codify.
import useQrCode from "react-qrcode-hook";
function App() {
useQrCode("Hello There");
return (
<div
style={{
width: "100%",
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center"
}}
>
<img alt="qr code" src={qrCode} />
</div>
);
}
Example
In the project folder:
yarn
yarn example
or
npm install
npm run example
Contributors
Thanks goes to these wonderful people
(emoji key):
This project follows the
all-contributors
specification. Contributions of any kind welcome!