mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
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:
@@ -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'));
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user