Files
mtdb_movie/common/resources/client/utils/hooks/use-linkified-string.ts
T
maher 511fad8199
Build / run (push) Has been cancelled
Initial commit
2026-05-14 13:42:10 +02:00

15 lines
320 B
TypeScript
Executable File

import {useMemo} from 'react';
import linkifyStr from 'linkify-string';
export function useLinkifiedString(text: string | null | undefined) {
return useMemo(() => {
if (!text) {
return text;
}
return linkifyStr(text, {
nl2br: true,
attributes: {rel: 'nofollow'},
});
}, [text]);
}