Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import React, { createContext } from 'react'; import { ShareModal, useShareModal } from '@lib/components/ShareModal'; const ShareModalContext = createContext<{ openShareModal: () => unknown; }>({ openShareModal: async () => { // pass } }); export const useShareModalContext = () => React.useContext(ShareModalContext); export function ShareModalProvider({ children, gameId }: { children: React.ReactNode; gameId: string; }) { const { props: shareModalProps, openShareModal } = useShareModal(); const value = React.useMemo(() => ({ openShareModal }), [openShareModal]); return ( <ShareModalContext.Provider value={value}> {children} <ShareModal {...shareModalProps} gameId={gameId} /> </ShareModalContext.Provider> ); } |