From 7f7af1914e3e10d2e58b6b8f88089670a6dba51d Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Wed, 1 Nov 2023 15:30:40 +0530 Subject: [PATCH] Fix React Warning for onKeyDown --- .../LivePreview/SelectableCard/index.js | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/OnboardingSPA/components/LivePreview/SelectableCard/index.js b/src/OnboardingSPA/components/LivePreview/SelectableCard/index.js index e557de095..3b21ee4c3 100644 --- a/src/OnboardingSPA/components/LivePreview/SelectableCard/index.js +++ b/src/OnboardingSPA/components/LivePreview/SelectableCard/index.js @@ -21,22 +21,16 @@ const SelectableCard = ( { className={ `${ className }` } role="button" tabIndex={ 0 } - onClick={ - typeof onClick === 'function' && - ( () => { - if ( ! loadingParent ) { - onClick(); - } - } ) - } - onKeyDown={ - typeof onClick === 'function' && - ( () => { - if ( ! loadingParent ) { - onClick(); - } - } ) - } + onClick={ () => { + if ( ! loadingParent && typeof onClick === 'function' ) { + onClick(); + } + } } + onKeyDown={ () => { + if ( ! loadingParent && typeof onClick === 'function' ) { + onClick(); + } + } } >