/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/src/components/pricing/LicenseModelContext.tsx
20 строк
595 B
Olivier Tassinari
[docs] Fix licensingModel -> licenseModel
26 авг 2024, 02:13
Не верифицирован
26 авг 2024, 02:13
10f68a2
Код
Авторство
О чём код?
import * as React from 'react'; const LicenseModel = React.createContext<any>({}); if (process.env.NODE_ENV !== 'production') { LicenseModel.displayName = 'LicenseModel'; } export function LicenseModelProvider(props: any) { const [licenseModel, setLicenseModel] = React.useState<string>('annual'); const value = React.useMemo( () => ({ licenseModel, setLicenseModel }), [licenseModel, setLicenseModel], ); return <LicenseModel.Provider value={value}>{props.children}</LicenseModel.Provider>; } export function useLicenseModel() { return React.useContext(LicenseModel); }