/
ai_sampletext
/
DiplomWork
Обзор
Документация
Войти
/
ai_sampletext
/
DiplomWork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
node_modules/react-style-singleton/dist/es2019/hook.js
22 строки
610 B
boolyshareyo
Initial commit
08 июн 2026, 16:00
08 июн 2026, 16:00
6216a29
Код
Авторство
О чём код?
import * as React from 'react'; import { stylesheetSingleton } from './singleton'; /** * creates a hook to control style singleton * @see {@link styleSingleton} for a safer component version * @example * ```tsx * const useStyle = styleHookSingleton(); * /// * useStyle('body { overflow: hidden}'); */ export const styleHookSingleton = () => { const sheet = stylesheetSingleton(); return (styles, isDynamic) => { React.useEffect(() => { sheet.add(styles); return () => { sheet.remove(); }; }, [styles && isDynamic]); }; };