Quellcode durchsuchen

react-panel: Use correct type for children prop to avoid the use of fragments <></>

Johannes Schill vor 7 Jahren
Ursprung
Commit
3908e64ef0

+ 2 - 2
public/app/core/components/CopyToClipboard/CopyToClipboard.tsx

@@ -1,4 +1,4 @@
-import React, { PureComponent } from 'react';
+import React, { PureComponent, ReactNode } from 'react';
 import ClipboardJS from 'clipboard';
 
 interface Props {
@@ -7,7 +7,7 @@ interface Props {
   onSuccess?: (evt: any) => void;
   onError?: (evt: any) => void;
   className?: string;
-  children?: JSX.Element | string;
+  children?: ReactNode;
 }
 
 export class CopyToClipboard extends PureComponent<Props> {

+ 1 - 3
public/app/features/dashboard/dashgrid/QueryInspector.tsx

@@ -211,9 +211,7 @@ export class QueryInspector extends PureComponent<Props, State> {
             text={this.getTextForClipboard}
             onSuccess={this.onClipboardSuccess}
           >
-            <>
-              <i className="fa fa-clipboard" /> Copy to Clipboard
-            </>
+            <i className="fa fa-clipboard" /> Copy to Clipboard
           </CopyToClipboard>
         </div>