avoid lambda props

This fixes the simple cases of callback props using lambda functions.
This will prevent rerendering in some cases since a new callback
function is not created on each call.
This commit is contained in:
David Lechner
2022-03-12 15:19:50 -06:00
parent c229d407cf
commit de7e046d31
7 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ const ActionButton: React.VoidFunctionComponent<ActionButtonProps> = (props) =>
title={i18n.translate(props.toolTipId, props.toolTipReplacements)}
disabled={props.disabled}
onMouseDown={preventFocusOnClick}
onClick={() => props.onClick()}
onClick={props.onClick}
/>
);
};
+3 -3
View File
@@ -51,15 +51,15 @@ const NewFileWizard: React.VoidFunctionComponent<NewFileWizardProps> = (props) =
isOpen={props.isOpen}
onOpening={() => setFileName('')}
onOpened={() => fileNameInputRef.current?.focus()}
onClose={() => props.onClose()}
onClose={props.onClose}
>
<div className={Classes.DIALOG_BODY}>
<FileNameFormGroup
fileName={fileName}
fileExtension={pythonFileExtension}
inputRef={fileNameInputRef}
onChange={(n) => setFileName(n)}
onValidation={(r) => setFileNameValidation(r)}
onChange={setFileName}
onValidation={setFileNameValidation}
/>
<FormGroup label={i18n.translate(NewFileWizardStringId.SmartHubLabel)}>
<RadioGroup
+2 -2
View File
@@ -52,8 +52,8 @@ const RenameFileDialog: React.VoidFunctionComponent<RenameFileDialogProps> = (
fileName={newName}
fileExtension={extension}
inputRef={inputRef}
onChange={(n) => setNewName(n)}
onValidation={(r) => setResult(r)}
onChange={setNewName}
onValidation={setResult}
/>
</div>
<div className={Classes.DIALOG_FOOTER}>