Skip to content

Instantly share code, notes, and snippets.

@Daltonic
Created September 1, 2023 10:04
Show Gist options
  • Save Daltonic/6c344f7cb08c0aa591a0264551a3d408 to your computer and use it in GitHub Desktop.
Save Daltonic/6c344f7cb08c0aa591a0264551a3d408 to your computer and use it in GitHub Desktop.
Dapp Votes
import { AppProps } from 'next/app'
import '@/styles/global.css'
import { Provider } from 'react-redux'
import { store } from '@/store'
import { ToastContainer } from 'react-toastify'
import 'react-toastify/dist/ReactToastify.css'
import { useEffect, useState } from 'react'
import { checkWallet } from '@/services/blockchain'
import CometChatNoSSR from '@/components/CometChatNoSSR'
export default function MyApp({ Component, pageProps }: AppProps) {
const [showChild, setShowChild] = useState<boolean>(false)
useEffect(() => {
checkWallet()
setShowChild(true)
}, [])
if (!showChild || typeof window === 'undefined') {
return null
} else {
return (
<Provider store={store}>
<CometChatNoSSR />
<Component {...pageProps} />
<ToastContainer
position="bottom-center"
autoClose={5000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="dark"
/>
</Provider>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment