useRandomId

useRandomId

import useRandomId from "@kiwicom/orbit-components/lib/hooks/useRandomId"`
const App = () => {
const titleId = useRandomId();
return (
<svg aria-labelledBy={titleId}>
<title id={titleId}>some title</title>
...
</svg>
);
};
import { useRandomIdSeed } from "@kiwicom/orbit-components/lib/hooks/useRandomId"`
const App = () => {
const randomId = useRandomIdSeed();
const titleId = randomId("title");
const descriptionId = randomId("description");
return (
<svg aria-labelledBy={`${titleId} ${descriptionId}`}>
<title id={titleId}>some title</title>
<desc id={descriptionId}>some description</desc>
...
</svg>
);
};