@selfcommunity/react-core
Version:
React Core Components useful for integrating UI Community components (react-ui).
34 lines (33 loc) • 940 B
TypeScript
import React from 'react';
import { SCContextProviderType, SCContextType } from '../../../types';
/**
* Creates Global Context
*
:::tip Context can be consumed in one of the following ways:
```jsx
1. <SCContext.Consumer>{settings => (...)}</SCContext.Consumer>
```
```jsx
2. const scContext: SCContextType = useContext(SCContext);
```
```jsx
3. const scContext: SCContextType = useSCContext();
````
:::
*/
export declare const SCContext: React.Context<SCContextType>;
/**
* This component imports all providers
* @param conf
* @param children
* @return
* ```jsx
* <SCContext.Provider value={{settings}}>
* ```
*/
export default function SCContextProvider({ conf, children }: SCContextProviderType): JSX.Element;
/**
* Let's only export the `useSCContext` hook instead of the context.
* We only want to use the hook directly and never the context component.
*/
export declare function useSCContext(): SCContextType;