import React , { useState , useEffect } from "react" ; import { AppProps } from "next/app" ; import Router from "next/router" ; import Head from "next/head" ; import NProgress from "nprogress" ; Router . events . on ( "routeChangeStart" , ( ) => { NProgress . start ( ) ; } ) ; Router . events . on ( "routeChangeComplete" , ( ) => { NProgress . done ( ) ; } ) ; Router . events . on ( "routeChangeError" , ( ) => NProgress . done ( ) ) ; const App = ( { Component , pageProps } ) => { const [ isRedditBlocked , setIsRedditBlocked ] = useState < boolean > ( true ) ; useEffect ( ( ) => { let image = new Image ( ) ; image . src = "https://reddit.com/favicon.ico" ; image . onload = ( ) => { setIsRedditBlocked ( false ) ; } ; } , [ ] ) ; return ( < > < Head > < link rel = "stylesheet" type = "text/css" href = "/nprogress.css" / > < /Head> < Component isRedditBlocked = { isRedditBlocked } { ... pageProps } /> < />); } ; export default App ;