2.0 Overhaul start
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { createContext, useContext } from "react";
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
import type { Device } from "@core/stores/deviceStore.js";
|
||||
import type { Device } from '@core/stores/deviceStore.js';
|
||||
|
||||
export const DeviceContext = createContext<Device | undefined>(undefined);
|
||||
|
||||
export const useDevice = (): Device => {
|
||||
const context = useContext(DeviceContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useDevice must be used within a ConnectionProvider");
|
||||
throw new Error("useDevice must be used within a DeviceProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user