This commit is contained in:
Vut Pov 2020-07-15 13:22:40 +07:00
parent b35ca2e9a3
commit dc89784c2f
3 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,6 @@ export const useTestContext = baseUseContext(Context)
export const withTestContext = baseWithContext(Context, 'testContextProps') export const withTestContext = baseWithContext(Context, 'testContextProps')
// @ts-ignore
export const wrapTestProvider = baseContextWrap(TestContextProvider) export const wrapTestProvider = baseContextWrap(TestContextProvider)
export default TestContextProvider export default TestContextProvider

View File

@ -1,6 +1,6 @@
{ {
"name": "base-context-provider", "name": "base-context-provider",
"version": "1.0.2-a", "version": "1.0.2-b",
"description": "Made with create-react-library", "description": "Made with create-react-library",
"author": "vuthpov", "author": "vuthpov",
"license": "MIT", "license": "MIT",

View File

@ -31,13 +31,14 @@ class BaseContextProvider<PROPS = {}, STATE = {}> extends React.Component<
} }
} }
// @ts-ignore
interface ContextWrapConfig { interface ContextWrapConfig {
props: { props: {
[index: string]: any [index: string]: any
} }
} }
export const baseContextWrap = (Provider: any) => { export const baseContextWrap : any = (Provider: any) => {
return (Component: any, config?: ContextWrapConfig) => (props: any) => ( return (Component: any, config?: ContextWrapConfig) => (props: any) => (
<Provider {...config} children={<Component {...props} />} /> <Provider {...config} children={<Component {...props} />} />
) )