Support for Document MetaData
Learn how React 19 allows us to declaratively manage document metadata directly in our component tree, without external libraries.
In traditional web apps, document metadata—like the page title, description, or Open Graph tags—is managed in the HTML <head>
element. In React single-page applications (SPAs), these values often need to be dynamic as the user navigates between different views.
Before React 19, updating metadata in React required either manipulating the DOM manually using document.title
or relying on third-party libraries like react-helmet
. These approaches introduced boilerplate and pushed side effects outside of our JSX. React 19 introduces a major shift: we can now declare metadata tags like <title>
, <meta>
, and <link>
directly in our component’s JSX.
Manual metadata updates
Befor ...