npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vuer-ai/react-helmet-async

v2.0.7

Published

Thread-safe Helmet for React 16+ and friends

Readme

react-helmet-async

A thread-safe Helmet for React 16+ that supports modern React features and server-side rendering.

Why react-helmet-async?

React Helmet is a fantastic library for managing your app's <head> tags from within your React component tree. However, the original react-helmet has thread safety issues with server-side rendering when using asynchronous operations.

This package solves those problems by:

  • Thread-safe SSR: Each request gets its own isolated context, preventing data leaks between concurrent requests
  • Modern React support: Built for React 16+ with support up to React 19
  • Async-friendly: Works seamlessly with Apollo GraphQL, data fetching, and other asynchronous operations
  • Familiar API: Drop-in replacement with minimal changes required

Originally created by The New York Times to solve production issues with meta tag management in high-traffic environments.

Installation

npm install @vuer-ai/react-helmet-async
# or
yarn add @vuer-ai/react-helmet-async
# or
pnpm add @vuer-ai/react-helmet-async

Quick Start

Client-side Usage

import React from 'react';
import ReactDOM from 'react-dom';
import { Helmet, HelmetProvider } from '@vuer-ai/react-helmet-async';

const App = () => (
  <HelmetProvider>
    <div>
      <Helmet>
        <title>My App</title>
        <meta name="description" content="My awesome React app" />
        <link rel="canonical" href="https://example.com/" />
      </Helmet>
      <h1>Hello World</h1>
    </div>
  </HelmetProvider>
);

ReactDOM.render(<App />, document.getElementById('root'));

Server-side Usage

import React from 'react';
import { renderToString } from 'react-dom/server';
import { Helmet, HelmetProvider } from '@vuer-ai/react-helmet-async';

// Create a fresh context for each request
const helmetContext = {};

const app = (
  <HelmetProvider context={helmetContext}>
    <App>
      <Helmet>
        <title>Server-rendered App</title>
        <meta name="description" content="Thread-safe meta tags" />
      </Helmet>
      <h1>Hello World</h1>
    </App>
  </HelmetProvider>
);

const html = renderToString(app);
const { helmet } = helmetContext;

// Use helmet data in your HTML template
const htmlTemplate = `
<!DOCTYPE html>
<html ${helmet.htmlAttributes.toString()}>
<head>
  ${helmet.title.toString()}
  ${helmet.meta.toString()}
  ${helmet.link.toString()}
</head>
<body ${helmet.bodyAttributes.toString()}>
  <div id="root">${html}</div>
</body>
</html>
`;

Key Features

Thread-Safe Server Rendering

Unlike the original react-helmet, this library properly isolates state per request, preventing the common issue where concurrent server requests would corrupt each other's meta tags.

SEO Tag Prioritization

Prioritize important SEO tags in the <head>:

<Helmet prioritizeSeoTags>
  <title>Important Title</title>
  <meta property="og:title" content="Social Media Title" />
  <link rel="canonical" href="https://example.com" />
  <meta name="description" content="Page description" />
</Helmet>

Works with Modern Data Fetching

Perfect for use with Apollo GraphQL, Relay, or any async data fetching:

import { getDataFromTree } from '@apollo/client/react/ssr';

const helmetContext = {};
const app = (
  <ApolloProvider client={client}>
    <HelmetProvider context={helmetContext}>
      <App />
    </HelmetProvider>
  </ApolloProvider>
);

await getDataFromTree(app);
const html = renderToString(app);
const { helmet } = helmetContext;

API

The API is nearly identical to the original react-helmet, with the key difference being the required <HelmetProvider> wrapper:

  • <HelmetProvider> - Provides context for Helmet instances
  • <Helmet> - Manages head tags (same API as original)
  • All the same tag types: title, meta, link, script, style, base, noscript
  • All the same attributes and props

React Version Support

This library supports:

  • React 16.6+
  • React 17.x
  • React 18.x
  • React 19.x

Migration from react-helmet

  1. Install @vuer-ai/react-helmet-async
  2. Replace imports: react-helmet@vuer-ai/react-helmet-async
  3. Wrap your app with <HelmetProvider>
  4. Update server-side rendering to use context instead of static methods

That's it! The rest of your <Helmet> components work exactly the same.

License

Licensed under the Apache 2.0 License