Remove usage of the PropTypes dependency (#2723)

* Remove usage of the PropTypes dependency

* Prettified Code!

---------

Co-authored-by: dhanusaputra <dhanusaputra@users.noreply.github.com>
This commit is contained in:
Dhanu Saputra
2023-02-23 00:21:00 +07:00
committed by GitHub
parent 0c08f865bc
commit 0a653aaba7
5 changed files with 25 additions and 38 deletions

View File

@@ -1,5 +1,4 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import React, { useState, FC, ReactElement } from 'react';
export const AlertMessageContext = React.createContext({
message: null,
@@ -7,7 +6,11 @@ export const AlertMessageContext = React.createContext({
setMessage: (text?: string) => null,
});
const AlertMessageProvider = ({ children }) => {
export type AlertMessageProviderProps = {
children: ReactElement;
};
const AlertMessageProvider: FC<AlertMessageProviderProps> = ({ children }) => {
const [message, setMessage] = useState('');
const providerValue = {
@@ -19,8 +22,4 @@ const AlertMessageProvider = ({ children }) => {
);
};
AlertMessageProvider.propTypes = {
children: PropTypes.element.isRequired,
};
export default AlertMessageProvider;