{"id":144711,"date":"2026-05-29T15:31:37","date_gmt":"2026-05-29T15:31:37","guid":{"rendered":"\/au\/tutorials\/what-is-preact"},"modified":"2026-05-29T15:31:37","modified_gmt":"2026-05-29T15:31:37","slug":"what-is-preact","status":"publish","type":"post","link":"\/au\/tutorials\/what-is-preact","title":{"rendered":"What is Preact and how it works"},"content":{"rendered":"<p>Preact is a lightweight alternative to React that delivers the same modern development features, including JSX and hooks, while using a much smaller JavaScript footprint. <\/p><p>It follows React&rsquo;s component-based approach but focuses on faster rendering and reduced browser overhead, improving loading and responsiveness on mobile devices and slower networks.<\/p><p>Modern front-end applications rely on JavaScript, and larger JavaScript files slow down loading, rendering, and page responsiveness. Lightweight frameworks like Preact reduce that overhead by shipping less code and updating the interface more efficiently through virtual DOM rendering.<\/p><p>Developers build Preact applications with reusable components and JSX syntax, which keeps interface code organized and easier to maintain. <\/p><p>Preact also supports hooks for state and lifecycle management, giving developers the same modern workflow as in React applications.<\/p><p>One of Preact&rsquo;s biggest advantages is its compatibility with React. With the <code>preact\/compat<\/code> layer, many React libraries and existing projects work with minimal changes, making Preact a practical choice for developers who want better performance without changing their entire development approach.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-preact\">What is Preact?<\/h2><p>Preact is a fast and lightweight JavaScript library for building user interfaces. Developers use it to create interactive websites and <a href=\"\/au\/tutorials\/what-is-web-application\" data-wpel-link=\"internal\" rel=\"follow\">web applications<\/a> with reusable components, JSX syntax, and modern front-end workflows similar to React. <\/p><p>Preact keeps the same general development experience while reducing framework size and browser overhead.<\/p><p>Most React concepts work the same way in Preact, including components, props, state management, hooks, and event handling. <\/p><p>Developers who already know <a data-wpel-link=\"internal\" href=\"\/au\/tutorials\/what-is-react\" rel=\"follow\">React<\/a> can start using Preact quickly because the API and project structure remain familiar. <\/p><p>Many React libraries also work through the <code>preact\/compat<\/code> layer, which helps teams reduce bundle size without rewriting an entire application.<\/p><p>Preact applications are built from components, which are small, reusable pieces of interface code. A navigation bar, search form, or product card can each exist as separate components that work together to build a complete page. <\/p><p>JSX syntax makes component code easier to read by combining HTML-like markup with JavaScript logic in the same file.<\/p><p>Preact updates the page through virtual DOM rendering. The virtual DOM is a lightweight representation of the real page structure inside the browser. <\/p><p>When data changes, Preact compares the updated virtual DOM with the previous version and updates only the necessary elements on the page. <\/p><p>A shopping cart counter, for instance, updates the number without reloading the entire interface. Smaller updates reduce browser work and improve rendering speed.<\/p><p>One of Preact&rsquo;s defining features is its small size. The core library is around 3kB, which is significantly smaller than many modern front-end frameworks.<\/p><p>Bundle size directly affects loading speed because browsers must download, parse, and execute JavaScript before users can interact with a page. <\/p><p>Smaller bundles improve startup performance, especially on mobile devices, older hardware, and slower internet connections.<\/p><p><a href=\"https:\/\/github.com\/developit\" data-wpel-link=\"external\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jason Miller<\/a> created Preact to provide a simpler and more efficient way to build modern interfaces without sacrificing the developer experience people liked in React. <\/p><p>The library is now widely used in performance-focused web applications, static sites, progressive web apps (PWAs), and embedded interfaces, where reducing JavaScript size improves usability and loading speed.<\/p><h3 class=\"wp-block-heading\">Preact vs React<\/h3><p>Preact and React use very similar development models, but they prioritize different goals. <\/p><p>React focuses on ecosystem depth, long-term scalability, and tooling support. <\/p><p>Preact focuses on smaller bundle sizes, faster startup performance, and lower browser overhead.<\/p><p>Developers write components, manage state, and use hooks in nearly the same way in both libraries. <\/p><p>JSX syntax, component structure, and rendering patterns are familiar across both ecosystems. A developer who knows React can move to Preact with very little adjustment.<\/p><p>The biggest difference in practice is bundle size. Preact&rsquo;s core library is about 3 to 4 kB when minified and gzipped, while React and ReactDOM together are tens of kilobytes after compression and much larger before optimization.<\/p><p>Smaller bundles reduce download time and browser processing, improving loading speed on slower networks and lower-powered devices.<\/p><p>Performance differences become more noticeable in lightweight applications, mobile-first websites, landing pages, dashboards, and progressive web apps (PWAs). <\/p><p>A smaller framework leaves more room for application code and assets without increasing page weight too quickly.<\/p><p>React has a larger ecosystem, which gives developers access to more third-party libraries, framework integrations, debugging tools, and learning resources. <\/p><p>The main differences between Preact and React:<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td colspan=\"1\" rowspan=\"1\"><p><strong>Feature<\/strong><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><strong>Preact<\/strong><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><strong>React<\/strong><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>Bundle size<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Around 3kB<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Significantly larger with ReactDOM<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>Performance<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Fast startup and lower browser overhead<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Strong runtime performance with a larger footprint<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>API style<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Very similar to React<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Standard React API<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>JSX support<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Yes<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Yes<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>Hooks support<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Yes<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Yes<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>Ecosystem size<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Smaller ecosystem<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Large ecosystem with extensive libraries<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>Compatibility<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Supports many React libraries through preact\/compat<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Native support across the React ecosystem<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>Learning curve<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Easy for React developers<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Widely taught and documented<\/span><\/p><\/td><\/tr><tr><td colspan=\"1\" rowspan=\"1\"><p><span>Best use cases<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Lightweight apps, PWAs, mobile-focused sites, performance-sensitive projects<\/span><\/p><\/td><td colspan=\"1\" rowspan=\"1\"><p><span>Large applications, enterprise platforms, advanced tooling workflows<\/span><\/p><\/td><\/tr><\/tbody><\/table><\/figure><p>Choose Preact when loading speed and small bundle sizes are top priorities. A marketing site, embedded widget, ecommerce storefront, or mobile-first application benefits from reduced JavaScript overhead and faster rendering.<\/p><p>Choose React when your project depends on advanced third-party libraries, large development teams, complex state management systems, or enterprise-level tooling. <\/p><p>React&rsquo;s ecosystem gives teams more flexibility for long-term scaling and integration-heavy applications.<\/p><h2 class=\"wp-block-heading\" id=\"h-preact-key-features\">Preact key features<\/h2><p>Preact combines fast rendering, reusable components, React-compatible APIs, and modern front-end tooling in a small JavaScript library. <\/p><p>Developers use Preact to build interactive interfaces with lower browser overhead and smaller bundle sizes than many larger front-end libraries.<\/p><h3 class=\"wp-block-heading\">Lightweight virtual DOM<\/h3><p>The virtual DOM is a lightweight JavaScript representation of the user interface. Instead of changing the browser page structure directly after every update, Preact first creates and updates this virtual representation in memory.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a19ea30cb2de\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a19ea30cb2de\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2026\/05\/what-is-preact-image1-1024x572.jpg\" alt=\"A step-by-step rendering flow diagram on a soft lavender gradient background illustrating how Preact processes UI updates.\" class=\"wp-image-149745\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Browsers require more work to update the real DOM because each change affects rendering, layout calculation, and visual painting on the page. <\/p><p>Direct DOM manipulation becomes slower as interfaces grow more complex. Preact reduces that overhead by comparing lightweight JavaScript objects before applying updates to the browser.<\/p><p>Preact stores the interface structure in memory and tracks changes there first. A button click, cart update, or search filter change updates the virtual DOM instead of rebuilding the entire page structure immediately. <\/p><p>Smaller calculations inside memory execute faster than repeated browser DOM operations.<\/p><h3 class=\"wp-block-heading\">Efficient rendering<\/h3><p>Preact renders interface updates through a process called diffing. Diffing compares the previous virtual DOM tree with the updated version after data changes.<\/p><p>The comparison process identifies exactly which elements changed between renders. If a user updates the quantity of a single product in a shopping cart, Preact updates only the related number and price instead of re-rendering the entire page.<\/p><p>Selective updates reduce unnecessary browser work and improve rendering speed. Smaller DOM updates also help maintain responsive interfaces during animations, filtering actions, form input, and other interactive behavior.<\/p><p>Efficient rendering becomes more noticeable in interfaces that frequently update. Dashboards, search results, notifications, and live data feeds benefit from faster update cycles because the browser processes fewer changes at once.<\/p><h3 class=\"wp-block-heading\">Functional components<\/h3><p>Preact applications are built from reusable functional components written with JavaScript and JSX. A functional component is a JavaScript function that returns part of the user interface.<\/p><p>Components help developers organize interfaces into smaller, reusable sections. Navigation menus, login forms, buttons, product cards, and search bars can each exist as separate components with their own structure and behavior.<\/p><p>JSX allows developers to describe interface structure directly inside JavaScript code. HTML-like syntax inside components makes layouts easier to read and maintain because markup and rendering logic stay in the same place.<\/p><p>Props allow components to receive dynamic data from other components. A product card component, for instance, can receive a product name, image, and price through props and render different products using the same reusable structure.<\/p><p>Component composition helps developers combine smaller interface pieces into larger layouts. A product page can include separate components for navigation, filters, product listings, reviews, and checkout. <\/p><p>Reusable architecture makes projects easier to scale and maintain over time.<\/p><h3 class=\"wp-block-heading\">Hooks<\/h3><p>Hooks are functions that allow components to manage state, handle side effects, and control dynamic interface behavior. <\/p><p>Hooks add application logic directly into functional components without requiring a separate class-based structure.<\/p><p>State management allows components to store and update changing data. The <code>useState<\/code> hook manages values for form inputs, counters, dropdown selections, and modal visibility. <\/p><p>A search field, for instance, can update results instantly as the user types.<\/p><p>The <code>useEffect<\/code> hook handles side effects and external operations. Developers use it to load API data, update the page after user actions, synchronize interface changes, or trigger browser events after rendering.<\/p><p>Hooks also help manage interactive behavior across the interface. Buttons can update counters, forms can validate input while users type, and product filters can refresh visible results immediately after selection changes.<\/p><p>Preact supports familiar React hooks, including <code>useState<\/code>, <code>useEffect<\/code>, <code>useMemo<\/code>, and <code>useContext<\/code>.<\/p><p>Shared hook APIs simplify migration from React and reduce onboarding time for developers already familiar with React workflows.<\/p><h3 class=\"wp-block-heading\">Compatibility with React libraries<\/h3><p>Preact supports many React libraries through <code>preact\/compat<\/code>, a compatibility layer that maps React-style imports and APIs to Preact. <\/p><p>Developers can reuse large parts of existing React projects while reducing bundle size and browser overhead.<\/p><p>Developers use <code>preact\/compat<\/code> in the following ways:<\/p><ul class=\"wp-block-list\">\n<li>Migrating React applications to Preact to reduce JavaScript bundle size<\/li>\n\n\n\n<li>Keeping familiar React development patterns while working in Preact<\/li>\n\n\n\n<li>Reusing compatible React components and third-party libraries<\/li>\n\n\n\n<li>Maintaining similar workflows for teams already familiar with React<\/li>\n<\/ul><p>React compatibility reduces migration effort, but developers still need to verify library support before switching projects completely. <\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a19ea30cd56c\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a19ea30cd56c\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2026\/05\/what-is-preact-image2-1024x572.jpg\" alt=\"A bridge-style compatibility illustration on a pale lavender gradient background demonstrating how React libraries can be used inside a Preact application.\" class=\"wp-image-149746\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Some React-specific libraries, advanced APIs, testing environments, and development tools may require additional configuration. Certain tools also work more reliably in standard React environments.<\/p><h3 class=\"wp-block-heading\">TypeScript support<\/h3><p>Preact supports TypeScript for type-safe front-end development. Developers can build typed components, validate props, and improve code consistency across larger applications.<\/p><p>TypeScript helps catch errors during development before code reaches production. Incorrect property values, missing function arguments, and invalid data structures are easier to detect with static type checking.<\/p><p>Typed components also improve developer tooling. Editors can provide autocomplete suggestions, inline documentation, and faster error detection while developers write code.<\/p><p>Larger projects benefit from stronger structure and easier maintenance because types make component behavior more predictable across teams and shared codebases. <\/p><p>Preact integrates with modern TypeScript workflows in a way similar to React, keeping setup and development patterns familiar.<\/p><h3 class=\"wp-block-heading\">Modern JavaScript support<\/h3><p>Preact supports modern front-end development features such as JSX, ES modules, and modern JavaScript syntax. Developers can integrate Preact into current workflows without changing standard front-end tooling practices.<\/p><p>JSX simplifies component rendering by allowing developers to define interface structure directly inside JavaScript. ES modules organize application code into reusable imports and exports, which improves project structure and maintainability.<\/p><p>Modern JavaScript syntax, such as arrow functions, destructuring, async functions, and template literals, works naturally inside Preact applications. Developers can build applications using the same language features commonly used across modern front-end ecosystems.<\/p><p>Preact also integrates with popular build tools and package management workflows. <\/p><p>Development environments using Vite, Webpack, Babel, npm, or pnpm support Preact without major configuration changes. <\/p><p>Compatibility with modern tooling helps developers adopt Preact more efficiently within existing front-end projects.<\/p><h2 class=\"wp-block-heading\" id=\"h-why-developers-use-preact\">Why developers use Preact<\/h2><p>Developers choose Preact because it delivers modern front-end features in a much smaller package than many larger JavaScript libraries and frameworks.<\/p><p>The following features are where Preact provides the biggest practical advantages:<\/p><ul class=\"wp-block-list\">\n<li><strong>Small bundle size<\/strong> &ndash; Preact&rsquo;s core library is around 3kB gzipped. Smaller JavaScript bundles reduce download time, browser parsing time, and script execution overhead, which helps pages load faster.<\/li>\n\n\n\n<li><strong>Faster performance<\/strong> &ndash; Lightweight rendering and efficient virtual DOM updates improve interface responsiveness. Faster updates are especially useful on mobile devices, slower networks, and lower-powered hardware.<\/li>\n\n\n\n<li><strong>Lower memory usage<\/strong> &ndash; Smaller framework overhead reduces runtime memory consumption. Resource-constrained devices benefit from lighter browser workloads and fewer processing demands.<\/li>\n\n\n\n<li><strong>React compatibility<\/strong> &ndash; The <code>preact\/compat<\/code> package allows many React libraries and components to work with Preact. Developers can keep familiar React-style workflows while reducing application size.<\/li>\n\n\n\n<li><strong>Modern development support<\/strong> &ndash; Preact supports JSX, hooks, TypeScript, ES modules, and modern JavaScript syntax. Common front-end tools such as Vite, Babel, and Webpack also integrate smoothly into Preact projects.<\/li>\n\n\n\n<li><strong>Good fit for lightweight applications<\/strong> &ndash; Preact works well for static sites, progressive web apps (PWAs), embedded widgets, dashboards, and performance-focused front-end applications where keeping JavaScript size low improves loading speed and responsiveness.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-what-are-preacts-use-cases\">What are Preact&rsquo;s use cases?<\/h2><p>Preact is commonly used for lightweight front-end applications that benefit from smaller JavaScript bundles, faster rendering, and lower browser overhead. <\/p><p>Developers use it in projects where loading speed, responsiveness, and efficient resource usage directly affect the user experience. These include:<\/p><ul class=\"wp-block-list\">\n<li><strong>Progressive web apps (PWAs)<\/strong> &ndash; Preact works well for PWAs that need fast startup performance, responsive navigation, and smooth mobile interaction. Smaller bundles help applications load more quickly on unstable mobile connections and lower-powered devices.<\/li>\n\n\n\n<li><strong>Static websites<\/strong> &ndash; Marketing sites, documentation platforms, blogs, and content-driven websites benefit from Preact&rsquo;s lightweight runtime. Faster page interaction and reduced JavaScript processing improve responsiveness after the initial page load.<\/li>\n\n\n\n<li><strong>Embedded applications and widgets<\/strong> &ndash; Lightweight dashboards, chat widgets, search tools, pricing calculators, and interactive product blocks fit well with Preact&rsquo;s small footprint. Smaller embedded applications place less strain on the host page and reduce browser resource usage.<\/li>\n\n\n\n<li><strong>Mobile-first applications<\/strong> &ndash; Mobile-focused interfaces benefit from reduced browser processing and faster rendering performance. Preact helps improve responsiveness on slower networks, older smartphones, and devices with limited memory or processing power.<\/li>\n\n\n\n<li><strong>React-compatible projects<\/strong> &ndash; Existing React projects can use Preact through <code>preact\/compat<\/code> to reduce bundle size while keeping similar component patterns and development workflows. Compatibility support also allows developers to reuse many React libraries and components without rebuilding the application structure from scratch.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-what-are-the-limitations-of-preact\">What are the limitations of Preact?<\/h2><p>Preact prioritizes lightweight performance and small bundle sizes, so it comes with trade-offs in compatibility, tooling, and ecosystem depth. Developers should check these limits before replacing React in a complex project.<\/p><ul class=\"wp-block-list\">\n<li><strong>React library compatibility<\/strong> &ndash; Preact does not cover every React library or advanced API. Some React-specific packages require additional setup, while others work more reliably in a React project.<\/li>\n\n\n\n<li><strong>Smaller ecosystem<\/strong> &ndash; React has more plugins, tutorials, integrations, debugging tools, and community resources. Preact still has strong core features, but developers may find fewer ready-made examples or package-specific guides.<\/li>\n\n\n\n<li><strong>Debugging differences<\/strong> &ndash; Some React debugging workflows need adjustment in Preact. React DevTools support, testing setups, and framework-specific debugging tools may require additional configuration depending on the project setup.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-how-to-deploy-your-preact-application\">How to deploy your Preact application<\/h2><p>Preact applications need to be built into optimized production files before deployment. The build process prepares your application for faster loading, smaller asset sizes, and production-ready performance.<\/p><p><strong>1. Run the production build command<\/strong><\/p><p>Build the application with:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">npm run build<\/pre><p>The command generates optimized production files, usually inside a <code>dist\/<\/code> or <code>build\/<\/code> folder, depending on your project setup and build tool.<\/p><p><strong>2. Upload the production files<\/strong><\/p><p>Upload the generated <code>dist\/<\/code> or <code>build\/<\/code> folder to your hosting platform. Static hosting providers serve these files directly to visitors through a CDN or web server.<\/p><p><strong>3. Configure SPA fallback routing if needed<\/strong><\/p><p>Applications that use client-side routing need SPA (single-page application) fallback routing. A direct visit to routes such as <code>\/dashboard<\/code> or <code>\/settings\/<\/code>should load the main application entry file instead of returning a 404 error.<\/p><p><strong>4. Deploy through your hosting provider<\/strong><\/p><p>Deploy the application through Hostinger web <a href=\"\/au\/web-apps-hosting\" data-wpel-link=\"internal\" rel=\"follow\">app hosting<\/a> or another hosting provider that supports modern JavaScript front-end applications. Hostinger enables developers to <a href=\"\/au\/tutorials\/how-to-host-a-web-application\" data-wpel-link=\"internal\" rel=\"follow\">host a web application<\/a> using static hosting workflows, Git-based deployments, and modern front-end build environments.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-web-hosting\" href=\"\/au\/web-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p><\/p><p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Preact is a lightweight alternative to React that delivers the same modern development features, including JSX and hooks, while using a much smaller JavaScript footprint. It follows React&rsquo;s component-based approach but focuses on faster rendering and reduced browser overhead, improving loading and responsiveness on mobile devices and slower networks. Modern front-end applications rely on JavaScript, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/au\/tutorials\/what-is-preact\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":530,"featured_media":144712,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"What is Preact? A complete guide to the Preact framework","rank_math_description":"Learn what Preact is, how it works, its core features, performance advantages, and why developers use it as a lightweight React alternative.","rank_math_focus_keyword":"what is preact","footnotes":""},"categories":[22651],"tags":[],"class_list":["post-144711","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-app"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/what-is-preact","default":1},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/what-is-preact","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/what-is-preact","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/what-is-preact","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/what-is-preact","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/what-is-preact","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/what-is-preact","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/what-is-preact","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/posts\/144711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/users\/530"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/comments?post=144711"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/posts\/144711\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/media\/144712"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/media?parent=144711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/categories?post=144711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/tags?post=144711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}