import { useEffect } from "react"; import { useCameraFeedContext } from "../../../../app/context/CameraFeedContext"; type CameraPanelProps = { tabIndex: number; }; const CameraPanel = ({ tabIndex }: CameraPanelProps) => { const { dispatch } = useCameraFeedContext(); useEffect(() => { const mapIndextoCameraId = () => { switch (tabIndex) { case 1: return "A"; case 2: return "B"; case 3: return "C"; default: return null; } }; const cameraId = mapIndextoCameraId(); console.log(cameraId); dispatch({ type: "SET_CAMERA_FEED", payload: cameraId }); }, [dispatch, tabIndex]); return