fix ssr and client side rendering difference warnings
This commit is contained in:
parent
ef533d41a6
commit
6ed2c87c49
|
@ -29,9 +29,15 @@ function WalletSummary ({ me }) {
|
||||||
|
|
||||||
function Back () {
|
function Back () {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
if (typeof window !== 'undefined' && router.asPath !== '/' &&
|
const [show, setShow] = useState()
|
||||||
(typeof window.navigation === 'undefined' || window.navigation.canGoBack === undefined || window?.navigation.canGoBack)) {
|
|
||||||
return <a role='button' tabindex='0' className='nav-link p-0' onClick={() => router.back()}><BackArrow className='theme standalone mr-1 mr-md-2' width={22} height={22} /></a>
|
useEffect(() => {
|
||||||
|
setShow(typeof window !== 'undefined' && router.asPath !== '/' &&
|
||||||
|
(typeof window.navigation === 'undefined' || window.navigation.canGoBack === undefined || window?.navigation.canGoBack))
|
||||||
|
}, [router.asPath])
|
||||||
|
|
||||||
|
if (show) {
|
||||||
|
return <a role='button' tabIndex='0' className='nav-link standalone p-0' onClick={() => router.back()}><BackArrow className='theme mr-1 mr-md-2' width={22} height={22} /></a>
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue