mirror of
https://github.com/owncast/owncast.git
synced 2024-12-23 09:40:49 +03:00
0a653aaba7
* Remove usage of the PropTypes dependency * Prettified Code! --------- Co-authored-by: dhanusaputra <dhanusaputra@users.noreply.github.com>
25 lines
656 B
TypeScript
25 lines
656 B
TypeScript
import React, { useState, FC, ReactElement } from 'react';
|
|
|
|
export const AlertMessageContext = React.createContext({
|
|
message: null,
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
setMessage: (text?: string) => null,
|
|
});
|
|
|
|
export type AlertMessageProviderProps = {
|
|
children: ReactElement;
|
|
};
|
|
|
|
const AlertMessageProvider: FC<AlertMessageProviderProps> = ({ children }) => {
|
|
const [message, setMessage] = useState('');
|
|
|
|
const providerValue = {
|
|
message,
|
|
setMessage,
|
|
};
|
|
return (
|
|
<AlertMessageContext.Provider value={providerValue}>{children}</AlertMessageContext.Provider>
|
|
);
|
|
};
|
|
|
|
export default AlertMessageProvider;
|