@selfcommunity/react-core
Version:
React Core Components useful for integrating UI Community components (react-ui).
37 lines (35 loc) • 1.14 kB
TypeScript
import React from 'react';
import { SCAlertMessagesContextType } from '../../../types';
/**
* Creates Global Context
*
:::tip Context can be consumed in one of the following ways:
```jsx
1. <SCAlertMessagesContext.Consumer>{(options,) => (...)}</SCAlertMessagesContext.Consumer>
```
```jsx
2. const scAlertMessagesContext: SCAlertMessagesContextType = useContext(SCAlertMessagesContext)
```
```jsx
3. const scAlertMessagesContext: SCAlertMessagesContextType = useSCAlertMessages();
````
:::
*/
export declare const SCAlertMessagesContext: React.Context<SCAlertMessagesContextType>;
/**
* #### Description:
* This component makes the `intl` available down the React tree.
* @param children
* @return
* ```jsx
* <SCAlertMessagesContext.Provider value={{options}}>
* ```
*/
export default function SCAlertMessagesProvider({ children }: {
children: React.ReactNode;
}): JSX.Element;
/**
* Let's only export the `useSCAlertMessages` hook instead of the context.
* We only want to use the hook directly and never the context component.
*/
export declare function useSCAlertMessages(): SCAlertMessagesContextType;