react-cap
A fork of react-helmet with a modified public API
A JavaScript library for managing web page metadata like titles and meta tags in React apps. It's a fork of react-helmet that removes tracking attributes and fixes server-side streaming issues.
react-cap is a JavaScript tool that helps manage the invisible metadata in a web page's ` section — things like the page title, meta description tags, and other behind-the-scenes information that browsers and search engines rely on. It's a modified version of an existing, popular library called react-helmet, with one key difference: it removes certain technical markers that the original library leaves behind in the HTML.
The original react-helmet adds small attribute tags (specifically data-react-helmet) to HTML elements so it can track which metadata it's managing. This fork strips those out. The tradeoff is that react-cap assumes it's the only thing managing your page's metadata. If you have HTML elements that are set up some other way, react-cap might accidentally remove them. To prevent that, you can add a special attribute (data-ignore-metadata`) to any element you want left alone, either protecting the whole element or just specific attributes.
This matters most for developers building server-rendered React applications that use streaming — a technique where the server starts sending HTML to the browser before the full page is ready. The original react-helmet had issues working smoothly with React 16's streaming interface, and this package was built to solve that problem. A related project called react-html-metadata is referenced for those who need full server-side streaming support.
One practical gotcha: if a developer is using webpack's style-loader to handle CSS, react-cap might strip out the style tags it injects. The README includes specific configuration instructions to tell react-cap to leave those tags alone.
Beyond these modifications, the package works exactly like react-helmet, and the README directs readers to the original react-helmet documentation for full usage details.
Where it fits
- Manage page titles and meta description tags in a server-rendered React app that streams HTML to the browser.
- Use it as a drop-in replacement for react-helmet when you don't want data-react-helmet attributes in your HTML.
- Control which HTML elements react-cap should leave untouched using the data-ignore-metadata attribute.
- Configure react-cap to work alongside webpack's style-loader without stripping injected style tags.