Skip to content

Commit

Permalink
feat: recoil Provider 적용 #47
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgksqkr committed Jul 23, 2024
1 parent aeb97fe commit fa51ac4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Global, ThemeProvider } from '@emotion/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import ReactDOM from 'react-dom/client';
import { RecoilRoot } from 'recoil';

import App from './App';
import GlobalStyle from './styles/GlobalStyle';
Expand All @@ -21,10 +22,12 @@ const enableMocking = async () => {
enableMocking().then(() => {
ReactDOM.createRoot(document.getElementById('root')!).render(
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={Theme}>
<Global styles={GlobalStyle} />
<App />
</ThemeProvider>
<RecoilRoot>
<ThemeProvider theme={Theme}>
<Global styles={GlobalStyle} />
<App />
</ThemeProvider>
</RecoilRoot>
</QueryClientProvider>,
);
});
11 changes: 7 additions & 4 deletions frontend/src/mocks/wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Global, ThemeProvider } from '@emotion/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { PropsWithChildren } from 'react';
import { RecoilRoot } from 'recoil';

import GlobalStyle from '@/styles/GlobalStyle';
import { Theme } from '@/styles/Theme';
Expand All @@ -16,10 +17,12 @@ const queryClient = new QueryClient({
const wrapper = ({ children }: PropsWithChildren) => {
return (
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={Theme}>
<Global styles={GlobalStyle} />
{children}
</ThemeProvider>
<RecoilRoot>
<ThemeProvider theme={Theme}>
<Global styles={GlobalStyle} />
{children}
</ThemeProvider>
</RecoilRoot>
</QueryClientProvider>
);
};
Expand Down

0 comments on commit fa51ac4

Please sign in to comment.