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,7 +1,6 @@
// TODO: add a notication after updating info that changes will take place either on a new stream or server restart. may be different for each field.
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import React, { useState, useEffect, FC, ReactElement } from 'react';
import { STATUS, fetchData, FETCH_INTERVAL, SERVER_CONFIG } from './apis';
import { ConfigDetails, UpdateArgs } from '../types/config-section';
@ -101,7 +100,11 @@ export const ServerStatusContext = React.createContext({
setFieldInConfigState: (args: UpdateArgs) => null,
});
const ServerStatusProvider = ({ children }) => {
export type ServerStatusProviderProps = {
children: ReactElement;
};
const ServerStatusProvider: FC<ServerStatusProviderProps> = ({ children }) => {
const [status, setStatus] = useState(initialServerStatusState);
const [config, setConfig] = useState(initialServerConfigState);
@ -164,8 +167,4 @@ const ServerStatusProvider = ({ children }) => {
);
};
ServerStatusProvider.propTypes = {
children: PropTypes.element.isRequired,
};
export default ServerStatusProvider;