Last modified: August 22, 2025
Rather than using HubL to build modules, you can use JavaScript and React instead. JavaScript modules stitch server-rendered React components into the HTML generated by HubL, and also support client-side interactivity with islands. This enables you to have more precise control over where and when JavaScript is shipped and run in the browser.
Just like HubL-based modules, CMS React modules include a set of HubSpot-provided fields that you’ll use to configure and customize your modules. These are the same types of fields as HubL-based module fields, but with the added benefit of TypeScript definitions for autocompletion and validation.
Get started by following the CMS React module quickstart guide, or check out the fields reference documentation for the full list of available fields.
Benefits of building with React vs. HubL
At a high level, building with React comes with benefits including component composability, code reuse, broader community resources, and real access to JavaScript on the server at render time. Rendering React on the server means that there’s less of a divide between your code that serves the initial page HTML and your interactive browser code. In contrast, creating complex and interactive pages with HubL can lead to:- An increase of client-side JavaScript that slows down the page until it’s all been downloaded and executed.
- Needing to replicate or maintain UI logic across HubL and JavaScript in order to have HTML that is immediately visible and interactive.
Local development
When developing a CMS React project, you can start a Express + Vite local development server to view your local changes in the browser. This includes being able to view local changes on live HubSpot pages and page previews. Additionally, the local development server includes a Storybook integration so that you can start a Storybook instance alongside local development. Learn more about local development for CMS React projects.Building and deploying
CMS React is built on the developer projects framework, which uses a local build and deploy process. A project can be uploaded for build and deploy using thehs project upload
command. This command can be run in the root of your project, or you can include a directory path in the command.
hs project deploy
.
For more information about
hs project
CLI commands, check out the documentation or run hs project --help
.Fetching data
There are multiple methods of fetching data into React modules depending on your use case and HubSpot account subscription.- On the server-side, you can fetch data using GraphQL, HubL, and the
getServerSideProps
function. - On the client-side, you can use serverless functions to execute server-side code without exposing credentials on the front-end. Because CMS React uses the projects framework, you can package a private app in the project to authenticate serverless function requests, or use secrets as needed.
Styling
HubSpot CMS React projects support a number of styling methods, including the following libraries:- Tailwind
- styled-components
- styled-jsx
- CSS Modules
Limitations
The following features are not currently available for React-based modules:- Importing JavaScript modules into JavaScript partials.
- Online code editing within the design manager.
- Some HubL features, such as certain tags and filters, may not be supported in JavaScript components.