mirror of
https://github.com/zhigang1992/react.git
synced 2026-02-11 09:11:07 +08:00
20 lines
489 B
TypeScript
20 lines
489 B
TypeScript
import React from 'react'
|
|
|
|
export interface Configs {
|
|
onChange?: Function
|
|
isChinese?: boolean
|
|
updateChineseState: Function
|
|
sidebarScrollHeight: number
|
|
updateSidebarScrollHeight: Function
|
|
}
|
|
|
|
export const defaultConfigs: Configs = {
|
|
sidebarScrollHeight: 0,
|
|
updateSidebarScrollHeight: () => {},
|
|
updateChineseState: () => {},
|
|
}
|
|
|
|
export const ConfigContext = React.createContext<Configs>(defaultConfigs)
|
|
|
|
export const useConfigs = (): Configs => React.useContext(ConfigContext)
|