next.js/test/integration/app-tree/pages/index.js
index.js18 lines357 B
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
Quest for Codev2.0.0
/
SIGN IN