react-helmet-async 3.0: per-request head state for React 16 to 18, and a passthrough on React 19
Thread-safe Helmet for React 16+ and friends
At a glance
- What is it?
- react-helmet-async is a fork of React Helmet that swaps react-side-effect for a HelmetProvider holding state per request. Version 3.0.0 detects the React version at runtime, and on React 19 several of its features stop doing anything.
- Who is it for?
- Use react-helmet-async if you server-render React 16 to 18 and need head tags collected per request, or if you rely on titleTemplate, prioritizeSeoTags, htmlAttributes or onChangeClientState. A new React 19 project that needs none of those can drop it, since React hoists title, meta and link tags itself.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 3 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 26, 2026, and from our analysis. They are not legal advice.
Star history
- staylor/react-helmet-async2,302 ★ · +1
| Repository | 2026-10-14 | 2026-11-26 |
|---|---|---|
| staylor/react-helmet-async | 2.3k | 2.3k |
1 Stars in the last 43 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
react-side-effect is not thread-safe, so every request needs its own HelmetProvider
This package is a fork of React Helmet by nfl. The `<Helmet>` usage is the same, but server and client now both require a `<HelmetProvider>` to encapsulate state per request. The reason given is specific: react-helmet relies on react-side-effect, which is not thread-safe, so anything asynchronous on the server needs Helmet to encapsulate data on a per-request basis.
react-side-effect exposed a .rewind() method, which Helmet used when calling Helmet.renderStatic(). This fork drops that static route. You pass a context prop to HelmetProvider instead, and after renderToString you read the state from helmetContext.helmet. Calls such as helmet.title.toString() then produce the strings for your template.
The pattern will look familiar if you use Redux or Apollo, because it is a provider wrapped around the tree. Version 1.0.0 also removed the default export, so the import is `import { Helmet } from 'react-helmet-async'`. You can use Helmet outside a context by creating a stateful HelmetData instance and passing it to each Helmet.
Version 3.0.0 reads the React version at runtime and takes a different path on React 19
React 19 hoists title, meta, link, style and script elements to the head on its own. From 3.0.0 the package checks which React it is running under. On React 19 and above, Helmet renders actual DOM elements and lets React hoist them, HelmetProvider becomes a transparent passthrough, and the existing API stays compatible without code changes.
On React 16 to 18 the old behavior is kept. Helmet collects all instances, deduplicates tags and applies changes to the DOM by manual manipulation on the client, or serializes them for the response on the server.
One exception holds on both paths. htmlAttributes and bodyAttributes have no React 19 equivalent, so they are still applied through direct DOM manipulation. Anyone who sets a lang attribute or a body class through Helmet keeps getting the old mechanism even on the newest React.
On React 19 the SSR context object is never populated
The sharpest edge of the upgrade is server rendering. On React 19, title, meta and link tags rendered inside Helmet are placed directly in the React render output and hoisted to the head by React itself. The context object will not be populated with helmet state.
Code that does `const { helmet } = helmetContext;` and then writes helmet.title.toString() into an HTML template will find nothing to write. The suggested workaround is to render those tags directly in your component tree and let React 19 handle them natively.
The same logic covers streaming. React 19's renderToReadableStream handles title, meta and link hoisting natively during streaming, so the manual context extraction used in older streaming setups is not needed. A server that moves from React 18 to 19 and keeps the template-string approach reads an empty context.
Streaming only works if head data is produced outside renderToNodeStream
For React 16 to 18, there is a hard condition on streaming. The package only works with it if your head data is output outside of renderToNodeStream(). That is possible when your data hydration method already walks the React tree before rendering.
The example does this with getDataFromTree from react-apollo. The tree is parsed first, with HelmetProvider and its context in place, so the head values are known before any bytes of the body stream out. The renderToNodeStream call then handles only the body. If you do not already walk the tree for data, the head tags are not available when the first chunk has to be sent.
This ties the streaming path to a specific data-loading style. A project that renders streams without any tree-walking step has no documented way to get Helmet output into the head ahead of the body on React 16 to 18.
Jest tests that emulate SSR must set HelmetProvider.canUseDOM to false
When testing with Jest and you need to emulate server-side rendering, one line is required for the tests to behave as expected:
import { HelmetProvider } from 'react-helmet-async';
HelmetProvider.canUseDOM = false;Leave it out and the test does not behave like a server render.
The flag only matters on React 16 to 18. On React 19, HelmetProvider is a passthrough and canUseDOM has no effect. The repository itself tests with vitest and jsdom, and keeps an e2e directory with Playwright in its dev dependencies.
prioritizeSeoTags reorders the head on the server and does nothing on React 19
Some SEO tags should appear earlier in the head. Adding the prioritizeSeoTags flag to any Helmet component makes the server render expose a method for prioritizing the relevant tags. In the template you print helmet.title, then helmet.priority, then helmet.meta, helmet.link and helmet.script:
<html>
<head>
${helmet.title.toString()}
${helmet.priority.toString()}
${helmet.meta.toString()}
${helmet.link.toString()}
${helmet.script.toString()}
</head>
...
</html>In the example, the title comes first, then the og:title meta and the canonical link, and the tags marked notImportant come last. The list of prioritized tags and attributes lives in src/constants.ts.
On React 19 the flag has no effect. Tags render as ordinary JSX elements and their order in the head follows React's rendering order, so you control ordering by where you place them in the tree.
GitHub releases stop at 0.2.0 while package.json says 3.0.0, and the last push was 2026-03-03
The release list on GitHub is out of step with the code. The two entries are 0.2.0 on 2018-10-08, titled as a Fragment release with fixes, and 0.1.0 on 2018-05-02, the initial open source release. package.json declares version 3.0.0, so version numbers for recent work come from the package itself, not the releases page.
The repository is not archived, but the last push was 2026-03-03, which is not recent enough to call it actively maintained. Check the issue tracker for anything blocking you before choosing it.
The published package ships only the lib/ directory, with CommonJS and ES module builds plus type declarations, and sideEffects is false. Runtime dependencies are invariant, react-fast-compare and shallowequal. The peer range is React ^16.6.0 || ^17.0.0 || ^18.0.0 || ^19.0.0. The README adds that if you start a new React 19 project and need none of htmlAttributes, bodyAttributes, SSR context serialization, onChangeClientState, prioritizeSeoTags or titleTemplate, you may not need this package at all.
Editorial conclusion
Use react-helmet-async if you server-render React 16 to 18 and need head tags collected per request, or if you rely on titleTemplate, prioritizeSeoTags, htmlAttributes or onChangeClientState. A new React 19 project that needs none of those can drop it, since React hoists title, meta and link tags itself. Before upgrading to 3.0.0 on a React 19 server, check any code that reads helmetContext, because it will be empty there.
Frequently asked questions
What is react-helmet-async?
It is a fork of React Helmet that manages document head tags with a HelmetProvider so state is kept per request, avoiding the thread-safety problem of react-side-effect.
What is the use of react-helmet-async?
It sets title, meta and link tags from React components. It collects them per request on the server, which matters when anything asynchronous happens during server rendering.
How do I use react-helmet-async?
Wrap your app in HelmetProvider, import Helmet from react-helmet-async and put title and link tags inside it. On the server, pass a context object to HelmetProvider and read helmet from it after rendering.
How do I install react-helmet-async?
The package is named react-helmet-async and lists React 16.6 through 19 as its peer range. The README documents no install command, so use your package manager with that package name.
Official sources
Where developers are discussing it
Posts on Hacker News, dev.to and Lobsters that link to this repository, found by our scan of those communities. 1 in the last 30 days; newest first.
- This Week In React #306 : UI SDK, Fate, RSC, Next.js, Dragology, Helmet | Expo Simulators, Exact, Bottom Sheet | Solid, webpack, Node.jsdev.to · Nov 20, 2026 · 2 points · 0 comments
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/staylor-react-helmet-async)Star history chart for your README
[](https://hysenlabs.com/projects/staylor-react-helmet-async)Was this useful?