summaryrefslogtreecommitdiff
path: root/src/app/providers.tsx
blob: 2626c576ccd4e8aeab9ac95d731a8c2fba746a28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import * as React from 'react';
import { QueryClientProvider } from 'react-query';
import { RecoilRoot } from 'recoil';

import ErrorBoundary from '~/components/ErrorBoundary';
import StateProvider from '~/components/StateProvider';
import { queryClient } from '~/misc/query';
import { actions, initialState } from '~/store';

type Props = {
  children: React.ReactNode;
};

export function AppProviders({ children }: Props) {
  return (
    <ErrorBoundary>
      <RecoilRoot>
        <StateProvider initialState={initialState} actions={actions}>
          <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
        </StateProvider>
      </RecoilRoot>
    </ErrorBoundary>
  );
}