added location element
All checks were successful
backend-action / build-image (push) Successful in 1m50s
All checks were successful
backend-action / build-image (push) Successful in 1m50s
This commit is contained in:
32
components/locationContenxt.tsx
Normal file
32
components/locationContenxt.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
import {
|
||||
Dispatch,
|
||||
ReactNode,
|
||||
SetStateAction,
|
||||
createContext,
|
||||
useState,
|
||||
} from "react";
|
||||
|
||||
type LocationContextType = {
|
||||
zone: [number | undefined, Dispatch<SetStateAction<number | undefined>>];
|
||||
province: [number | undefined, Dispatch<SetStateAction<number | undefined>>];
|
||||
};
|
||||
|
||||
export const LocationContext = createContext<LocationContextType | undefined>(
|
||||
undefined
|
||||
);
|
||||
|
||||
export default function LocationContextProvider({
|
||||
children,
|
||||
}: {
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
let zone = useState<number | undefined>(undefined);
|
||||
let province = useState<number | undefined>(undefined);
|
||||
|
||||
return (
|
||||
<LocationContext.Provider value={{ zone, province }}>
|
||||
{children}
|
||||
</LocationContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user