Skip to content

Instantly share code, notes, and snippets.

@mxmtsk
mxmtsk / BaseLayout.tsx
Last active October 28, 2023 08:02
React implementation of Vue3 Adapater for https://github.com/lepikhinb/momentum-modal
/**
* Unfortunately I didn't find a way to add it directly to createInertiaApp so
* currently I'm placing it in my BaseLayout which is called on any route anyway
*/
import React from 'react';
import { ModalProvider } from '../components/momentum-modal/ModalContext';
const BaseLayout: React.FC = ({ children }) => {
/* Wrap your children with the provider */
return <ModalProvider resolve={(name) => import(`../pages/${name}`)}>{children}</ModalProvider>;