Skip to content

Commit

Permalink
Add new component with useEffect to app.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-codegen[bot] authored Aug 11, 2023
1 parent 55dc790 commit fc832a9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import React, { useEffect } from 'react';
import { type AppType } from "next/app";
import ThemeProvider from "@components/ui/Theme/ThemeProvider";
import "../styles/globals.css";
Expand All @@ -12,11 +13,22 @@ const queryClient = new QueryClient();

export const chatUserIdAtom = atom(uuid());

const NewComponent = () => {
useEffect(() => {
console.log('Component mounted');
return () => {
console.log('Component unmounted');
};
}, []);
return <div>NewComponent loaded</div>;
};

const MyApp: AppType = ({ Component, pageProps: { ...pageProps } }) => {
return (
// Provide the client to your App
<ThemeProvider>
<QueryClientProvider client={queryClient}>
<NewComponent />
<Component {...pageProps} />
</QueryClientProvider>
</ThemeProvider>
Expand Down

0 comments on commit fc832a9

Please sign in to comment.