Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
599 B · 26 lines
JSX
at main
123456789101112131415161718192021222324252627'use client';import React from 'react';
const SoundEnabledContext = React.createContext({});function SoundEnabledProvider({ children }) { const [soundEnabled, setSoundEnabled] = React.useState(true); return ( <SoundEnabledContext value={{ soundEnabled, setSoundEnabled }}> {children} </SoundEnabledContext> );}
export function useSoundEnabled() { const data = React.use(SoundEnabledContext);
if (!data) { throw new Error( 'Cannot consume SoundEnabled context without a SoundEnabledProvider', ); }
return data;}
export default SoundEnabledProvider;