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
@@ -10,7 +10,7 @@ import AboutDialog from './AboutDialog';
it('should close when the button is clicked', () => {
const close = jest.fn();
const [dialog] = testRender(<AboutDialog isOpen={true} onClose={() => close()} />);
const [dialog] = testRender(<AboutDialog isOpen={true} onClose={close} />);
userEvent.click(dialog.getByLabelText('Close'));
+2 -2
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 The Pybricks Authors
// Copyright (c) 2021-2022 The Pybricks Authors
// The about dialog
@@ -33,7 +33,7 @@ const AboutDialog: React.FunctionComponent<AboutDialogProps> = (props) => {
<Dialog
title={`Pybricks v${firmwareVersion} (${appName} v${appVersion})`}
isOpen={props.isOpen}
onClose={() => props.onClose()}
onClose={props.onClose}
>
<div className={Classes.DIALOG_BODY}>
<div className="pb-about-icon">