Skip to content

Latest commit

 

History

History
48 lines (38 loc) · 1.08 KB

File metadata and controls

48 lines (38 loc) · 1.08 KB
description Modern alternatives to the react-helmet package

Replacements for react-helmet

Support for Document Metadata (native, since React 19)

Support for Document Metadata is available since React 19

Example:

function BlogPost({ post }) {
  return (
    <article>
      <h1>{post.title}</h1>
      <title>{post.title}</title>
      <meta name="keywords" content={post.keywords} />
      <p>Eee equals em-see-squared...</p>
    </article>
  )
}

react-helmet-async

react-helmet-async is a fork of react-helmet.

Example:

import { Helmet } from 'react-helmet' // [!code --]
import { Helmet, HelmetProvider } from 'react-helmet-async' // [!code ++]

const app = (
  <HelmetProvider> // [!code ++]
    <App>
      <Helmet>
        <title>Hello World</title>
        <link rel="canonical" href="https://e18e.dev/" />
      </Helmet>
      <h1>Hello World</h1>
    </App>
  </HelmetProvider> // [!code ++]
)