aboutsummaryrefslogtreecommitdiffstats
path: root/packages/renderer/src/components/StoreProvider.tsx
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-09 22:16:29 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-09 22:17:26 +0100
commitfb7118ff1c8f0dcd61f15e51b193512283d83fa1 (patch)
tree721cee6a64b44a56b7f05f39750a65cda5fb4ef6 /packages/renderer/src/components/StoreProvider.tsx
parentbuild: Add eslint-plugin-jest (diff)
downloadsophie-fb7118ff1c8f0dcd61f15e51b193512283d83fa1.tar.gz
sophie-fb7118ff1c8f0dcd61f15e51b193512283d83fa1.tar.zst
sophie-fb7118ff1c8f0dcd61f15e51b193512283d83fa1.zip
build: Add eslint-plugin-unicorn
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/renderer/src/components/StoreProvider.tsx')
-rw-r--r--packages/renderer/src/components/StoreProvider.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/renderer/src/components/StoreProvider.tsx b/packages/renderer/src/components/StoreProvider.tsx
index bb8495c..3360a43 100644
--- a/packages/renderer/src/components/StoreProvider.tsx
+++ b/packages/renderer/src/components/StoreProvider.tsx
@@ -22,11 +22,12 @@ import React, { createContext, useContext } from 'react';
22 22
23import type { RendererStore } from '../stores/RendererStore'; 23import type { RendererStore } from '../stores/RendererStore';
24 24
25const StoreContext = createContext<RendererStore | null>(null); 25// eslint-disable-next-line unicorn/no-useless-undefined -- `createContext` expects 1 parameter.
26const StoreContext = createContext<RendererStore | undefined>(undefined);
26 27
27export function useStore(): RendererStore { 28export function useStore(): RendererStore {
28 const store = useContext(StoreContext); 29 const store = useContext(StoreContext);
29 if (store === null) { 30 if (store === undefined) {
30 throw new Error('useStore can only be called inside of StoreProvider'); 31 throw new Error('useStore can only be called inside of StoreProvider');
31 } 32 }
32 return store; 33 return store;