...

/

Support for Async Scripts

Support for Async Scripts

Learn React 19 lets us declaratively load external scripts and other script variations directly within JSX.

In modern web applications, we often need to include third-party JavaScript files—for analytics, widgets, chat popups, or libraries. But if loaded improperly, these scripts can block rendering and hurt performance. That’s why browsers support attributes like async and defer for loading scripts without blocking page load.

Before React 19, we couldn’t include a <script> tag directly in JSX the way we could with HTML. We had to use useEffect or manipulate the DOM manually, which broke React’s declarative model. With React 19, we can now declaratively include <script> tags inside our JSX—including support for async, defer, and other script attributes.

Manual script injection

Before React 19, to include a script like ...