mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -04:00
guh
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import { createContext, useContext } from 'react';
|
||||
import { useDriveControls as useDriveControlsHook } from '../hooks/useDriveControls.js';
|
||||
|
||||
/* eslint-disable react-refresh/only-export-components */
|
||||
|
||||
const DriveControlContext = createContext(null);
|
||||
|
||||
export function DriveControlProvider({ children }) {
|
||||
const controls = useDriveControlsHook();
|
||||
return <DriveControlContext.Provider value={controls}>{children}</DriveControlContext.Provider>;
|
||||
}
|
||||
|
||||
export function useDriveControl() {
|
||||
const context = useContext(DriveControlContext);
|
||||
if (!context) {
|
||||
throw new Error('useDriveControl must be used within DriveControlProvider');
|
||||
}
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user