File size: 357 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { useContext } from 'react'
import { DummyContext } from './_app'
import { useRouter } from 'next/router'

const Page = () => {
  const { pathname } = useRouter()
  const ctx = useContext(DummyContext)
  if (ctx == null) throw new Error('context consumes failed')

  return (
    <>
      <h3>page: {pathname}</h3>
    </>
  )
}

export default Page