garmeeh/next-seo

Next seo in the App router

Suriyasanjay opened this issue · 1 comments

import React from 'react'
import { NextSeo } from 'next-seo'

const page = () => {
    return (
        <>
            <NextSeo
                title="Job List"
                description="Build digital experiences for any tech stack, visually."
            />
        </>
    )
}
export default page

In Terminal
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    ⨯ TypeError: Cannot read properties of null (reading 'useContext')
    at stringify ()
    ⨯ TypeError: Cannot read properties of null (reading 'useContext')
    at stringify ()
    digest: "404728629"

In Browser

Unhandled Runtime Error
Error: Cannot read properties of null (reading 'useContext')

When I used next seo in pages file it usecontext provider error. Even i treid in the defult seo in the layout.tsx also it shows same error any way to next in pages app router

For standard SEO meta data you should use Next.js Metadata API

For the app directory next-seo is still useful for JSON-LD