From 0921e5f3c7100d09e1f81a6132648bdd865b74e1 Mon Sep 17 00:00:00 2001 From: Amit Dhamu Date: Tue, 26 Sep 2023 10:17:36 +0100 Subject: [PATCH] Optional chaining on matchMedia check --- src/Wrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wrapper.tsx b/src/Wrapper.tsx index f1673b4..10c8511 100644 --- a/src/Wrapper.tsx +++ b/src/Wrapper.tsx @@ -10,7 +10,7 @@ import { globalStyles } from './theme' import type { ReactNode } from 'react' const matchMediaFallback = (): boolean => - window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches + window.matchMedia?.('(prefers-color-scheme: dark)')?.matches const Wrapper = ({ children }: { children: ReactNode }) => { const {