import React from 'react' const BaseContext = React.createContext({}) /** * Component : BaseContextProvider * * @author sl * @time 13/2/20 * @param {{}} * @constructor * */ class BaseContextProvider extends React.Component< PROPS, STATE > { getContextReturnValue() { return {} } getContext() { return BaseContext } render() { const contextReturn = this.getContextReturnValue() const Context = this.getContext() const { children } = this.props return {children} } } // @ts-ignore interface ContextWrapConfig { props: { [index: string]: any } } export const baseContextWrap : any = (Provider: any) => { return (Component: any, config?: ContextWrapConfig) => (props: any) => ( } /> ) } export function baseUseContext(context: any) { return function () { return React.useContext(context) } } export function baseWithContext(context: any, contextPassPropKey: any) { const Consumer = context.Consumer return (Component: any) => (props: any) => ( {(contextValue: any) => ( )} ) } export default BaseContextProvider