Skip to content

Commit

Permalink
refactor: convert logical operator to optional chainining (#11033)
Browse files Browse the repository at this point in the history
The [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) operator can be used to perform null checks before accessing a property, or calling a function.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
deepsource-autofix[bot] authored Oct 24, 2023
1 parent d760671 commit 8045720
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ToggleDarkMode: React.FC<ToggleDarkModeProps> = ({
setDarkMode(!darkMode)
const newTheme = darkMode ? 'light' : 'dark'
setTheme(newTheme)
onChange && onChange(newTheme)
onChange?.(newTheme)
}

if (!mounted) return null
Expand Down

0 comments on commit 8045720

Please sign in to comment.