Read and generate barcodes and QR codes in React and Svelte.
npm install react-barcode-kit
npm install svelte-barcode-kit
import { useState } from "react"
import { BarcodeReader } from "react-barcode-kit"
function App() {
const [barcode, setBarcode] = useState(null)
return (
<div>
<BarcodeReader onScan={setBarcode}/>
<p>{barcode}</p>
</div>
)
}
export default App
import { Barcode } from "react-barcode-kit"
function App() {
return (
<div>
<Barcode>Your data goes here</Barcode>
</div>
)
}
export default App
<script>
import { BarcodeReader } from "svelte-barcode-kit"
let barcode = null
const handleBarcode = (data) => {
barcode = data
}
</script>
<BarcodeReader onScan={barcode}/>
<p>{barcode}</p>
<script>
import { Barcode } from "svelte-barcode-kit"
</script>
<Barcode>Your data goes here</Barcode>