added sound context, and functionality to select sighting sound
This commit is contained in:
18
src/context/providers/SoundContextProvider.tsx
Normal file
18
src/context/providers/SoundContextProvider.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useReducer, type ReactNode } from "react";
|
||||
import { SoundContext } from "../SoundContext";
|
||||
import { initalState, reducer } from "../reducers/SoundContextReducer";
|
||||
|
||||
type SoundContextProviderProps = {
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
const SoundContextProvider = ({ children }: SoundContextProviderProps) => {
|
||||
const [state, dispatch] = useReducer(reducer, initalState);
|
||||
return (
|
||||
<SoundContext.Provider value={{ state, dispatch }}>
|
||||
{children}
|
||||
</SoundContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export default SoundContextProvider;
|
||||
Reference in New Issue
Block a user