Chore: Avoid explicit React.FC<Props> when possible (round 2) (#64749)

This commit is contained in:
Ryan McKinley
2023-03-15 07:56:09 -07:00
committed by GitHub
parent 1a16636692
commit 4f13e78d11
147 changed files with 364 additions and 449 deletions

View File

@ -17,7 +17,7 @@ import React from 'react';
import { Button } from '@grafana/ui';
import { StandardEditorProps } from '@grafana/data';
export const SimpleEditor: React.FC<StandardEditorProps<boolean>> = ({ value, onChange }) => {
export const SimpleEditor = ({ value, onChange }: StandardEditorProps<boolean>) => {
return <Button onClick={() => onChange(!value)}>{value ? 'Disable' : 'Enable'}</Button>;
};
```
@ -51,7 +51,9 @@ interface Settings {
to: number;
}
export const SimpleEditor: React.FC<StandardEditorProps<number, Settings>> = ({ item, value, onChange }) => {
type Props = StandardEditorProps<number, Settings>;
export const SimpleEditor = ({ item, value, onChange }: Props) => {
const options: Array<SelectableValue<number>> = [];
// Default values
@ -97,7 +99,7 @@ The editor context is available through the `context` prop. The data frames retu
**SimpleEditor.tsx**
```ts
export const SimpleEditor: React.FC<StandardEditorProps<string>> = ({ item, value, onChange, context }) => {
export const SimpleEditor = ({ item, value, onChange, context }: StandardEditorProps<string>) => {
const options: SelectableValue<string>[] = [];
if (context.data) {