MCPcopy Create free account
hub / github.com/dailydotdev/apps / useDomPurify

Function useDomPurify

packages/shared/src/hooks/useDomPurify.ts:4–14  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import createDOMPurify, { type DOMPurify } from 'dompurify';
3
4export const useDomPurify = (): DOMPurify => {
5 const [purify, setPurify] = useState<DOMPurify>(
6 undefined as unknown as DOMPurify,
7 );
8
9 useEffect(() => {
10 setPurify(() => createDOMPurify(globalThis.window));
11 }, []);
12
13 return purify;
14};
15
16type PurifyObject = Record<string, string | Node>;
17

Callers 2

PostsSearchFunction · 0.90
MarkdownFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected