/
vshmidt
/
label-studio
Обзор
Документация
Войти
/
vshmidt
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
web/apps/labelstudio/src/providers/AppStoreProvider.jsx
29 строк
651 B
Raul Martin
refactor: echo 27: Introducing biome (#5759)
29 апр 2024, 11:39
Не верифицирован
29 апр 2024, 11:39
2660ec9
Код
Авторство
О чём код?
import React from "react"; const AppStoreContext = React.createContext(); AppStoreContext.displayName = "AppStoreContext"; export const AppStoreProvider = ({ children }) => { const [store, setStore] = React.useState({}); const update = React.useCallback( (newData) => { setStore({ ...store, ...(newData ?? {}) }); }, [store], ); const contextValue = React.useMemo( () => ({ store, update, }), [store, update], ); return <AppStoreContext.Provider value={contextValue}>{children}</AppStoreContext.Provider>; }; export const useAppStore = () => { return React.useContext(AppStoreContext); };