import type { PropsWithChildren } from 'react';
import { useMemo } from 'react';

import DataProvider from '../DataProvider';
import { MockApi } from './mock-api';

interface Props {fileExt:string}

function MockProvider(props: PropsWithChildren<Props>) {
  const { fileExt,children } = props;
  const api = useMemo(() => new MockApi(fileExt), []);

  return <DataProvider api={api}>{children}</DataProvider>;
}

export default MockProvider;
