React Helmet

6.1.0 · active · verified Sun Apr 19

React Helmet is a versatile React component designed to manage and manipulate the document head (`<head>`) of web pages. It enables developers to declaratively define metadata like titles, meta tags, link tags, script tags, and more directly within their component tree. The current stable version is 6.1.0, which re-introduced the default export pattern alongside the named export. While there's no strict release cadence, the project is actively maintained with updates addressing compatibility and feature enhancements. A key differentiator is its straightforward API that accepts plain HTML tags and its ability to handle server-side rendering, ensuring that the correct head elements are generated for initial page loads. It automatically handles nested components, where later or deeper components override duplicate head changes, simplifying SEO and page-specific metadata management.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates basic usage of React Helmet to set document head tags like `meta`, `title`, and `link` within a functional React component.

import React from "react";
import { Helmet } from "react-helmet";

function MyPage() {
  return (
    <div className="application">
      <Helmet>
        <meta charSet="utf-8" />
        <title>My Awesome Page Title</title>
        <link rel="canonical" href="https://mysite.com/current-page" />
        <meta name="description" content="A detailed description of my awesome page." />
        <meta property="og:title" content="Open Graph Title" />
        <meta property="og:description" content="Open Graph Description" />
        <meta property="og:image" content="https://mysite.com/image.jpg" />
      </Helmet>
      <h1>Welcome to my application!</h1>
      <p>This content is part of the page body.</p>
    </div>
  );
}

export default MyPage;

view raw JSON →