package.dist.components.qr-code.use-qr-code.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react Show documentation
Show all versions of react Show documentation
A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.
The newest version!
'use client';
import * as qrcode from '@zag-js/qr-code';
import { useMachine, normalizeProps } from '@zag-js/react';
import { useId } from 'react';
import { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';
import { useLocaleContext } from '../../providers/locale/use-locale-context.js';
const useQrCode = (props = {}) => {
const { getRootNode } = useEnvironmentContext();
const { dir } = useLocaleContext();
const context = {
id: useId(),
dir,
getRootNode,
...props
};
const [state, send] = useMachine(qrcode.machine(context), { context });
return qrcode.connect(state, send, normalizeProps);
};
export { useQrCode };
© 2015 - 2025 Weber Informatics LLC | Privacy Policy