Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
feat(provider): settings react query, react-toastify, recoil in helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubinquitous committed May 30, 2023
1 parent a895832 commit 0af07f5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Empty file removed src/utils/helpers/.gitkeep
Empty file.
41 changes: 41 additions & 0 deletions src/utils/helpers/provider.helper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use client";

import Header from "@/components/Header";
import React, { PropsWithChildren } from "react";
import { QueryClient, QueryClientProvider } from "react-query";
import { ToastContainer, toast } from "react-toastify";
import { RecoilRoot } from "recoil";
import styled from "styled-components";

const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
suspense: false,
},
},
});

const CustomToastContainer = styled(ToastContainer)`
.Toastify__toast {
color: black;
font-size: 14px;
}
`;

const Provider = ({ children }: PropsWithChildren) => {
return (
<QueryClientProvider client={queryClient}>
<RecoilRoot>
<CustomToastContainer
autoClose={1000}
position={toast.POSITION.TOP_RIGHT}
/>
<Header />
<React.Fragment>{children}</React.Fragment>
</RecoilRoot>
</QueryClientProvider>
);
};

export default Provider;

0 comments on commit 0af07f5

Please sign in to comment.