⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.

Overview

Preact

Fast 3kB alternative to React with the same modern API.

All the power of Virtual DOM components, without the overhead:

  • Familiar React API & patterns: ES6 Class, hooks, and Functional Components
  • Extensive React compatibility via a simple preact/compat alias
  • Everything you need: JSX, VDOM, DevTools, HMR, SSR.
  • Highly optimized diff algorithm and seamless hydration from Server Side Rendering
  • Supports all modern browsers and IE11
  • Transparent asynchronous rendering with a pluggable scheduler
  • Instant production-grade app setup with Preact CLI

💁 More information at the Preact Website ➞

npm Preact Slack Community OpenCollective Backers OpenCollective Sponsors

coveralls gzip size brotli size

You can find some awesome libraries in the awesome-preact list 😎


Getting Started

💁 Note: You don't need ES2015 to use Preact... but give it a try!

The easiest way to get started with Preact is to install Preact CLI. This simple command-line tool wraps up the best possible tooling for you, and even keeps things like Webpack and Babel up-to-date as they change. Best of all, it's easy to understand! Start a project or compile for production in a single command (preact build), with no configuration needed and best practices baked in! 🙌

Tutorial: Building UI with Preact

With Preact, you create user interfaces by assembling trees of components and elements. Components are functions or classes that return a description of what their tree should output. These descriptions are typically written in JSX (shown underneath), or HTM which leverages standard JavaScript Tagged Templates. Both syntaxes can express trees of elements with "props" (similar to HTML attributes) and children.

To get started using Preact, first look at the render() function. This function accepts a tree description and creates the structure described. Next, it appends this structure to a parent DOM element provided as the second argument. Future calls to render() will reuse the existing tree and update it in-place in the DOM. Internally, render() will calculate the difference from previous outputted structures in an attempt to perform as few DOM operations as possible.

import { h, render } from 'preact';
// Tells babel to use h for JSX. It's better to configure this globally.
// See https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#usage
// In tsconfig you can specify this with the jsxFactory
/** @jsx h */

// create our tree and append it to document.body:
render(<main><h1>Hello</h1></main>, document.body);

// update the tree in-place:
render(<main><h1>Hello World!</h1></main>, document.body);
// ^ this second invocation of render(...) will use a single DOM call to update the text of the <h1>

Hooray! render() has taken our structure and output a User Interface! This approach demonstrates a simple case, but would be difficult to use as an application grows in complexity. Each change would be forced to calculate the difference between the current and updated structure for the entire application. Components can help here – by dividing the User Interface into nested Components each can calculate their difference from their mounted point. Here's an example:

import { render, h } from 'preact';
import { useState } from 'preact/hooks';

/** @jsx h */

const App = () => {
	const [input, setInput] = useState('');

	return (
		<div>
			<p>Do you agree to the statement: "Preact is awesome"?</p>
			<input value={input} onChange={e => setInput(e.target.value)} />
		</div>
	)
}

render(<App />, document.body);

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]


License

MIT

Preact

Comments
  • Add support for componentDidCatch Component method

    Add support for componentDidCatch Component method

    Allow components to catch errors that occur during child components' constructors or lifecycle methods. For simplicity's sake does not pass a second "info" argument like React does. If no component catches and handles a thrown exception, DOM will be left in an inconsistent state as it is in react 8.2.1

    enhancement in X 
    opened by rpetrich 56
  • Ts improvements 2

    Ts improvements 2

    Tried to improved a little bit the types. Mostly copying React's definitions where needed. There is a breaking change though. I removed ComponentProps as in my opinion is not needed. The recommended way with react and ts2 is to use the ClassAttributes interface.

    types 
    opened by valotas 49
  • [question] should shouldUpdateComponent hook be considered a hint?

    [question] should shouldUpdateComponent hook be considered a hint?

    Hi, I'd like to apologize myself upfront if this is not the proper place to ask questions, but I couldn't find any discussion group or so. Please let me know where I should ask such questions.

    This is what React says about shouldUpdateComponent:

    https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate

    Currently, if shouldComponentUpdate() returns false, then componentWillUpdate(), render(), and componentDidUpdate() will not be invoked. Note that in the future React may treat shouldComponentUpdate() as a hint rather than a strict directive, and returning false may still result in a re-rendering of the component.

    I'd like to know if the same is valid for Preact as well. If this behavior changes it would possibly affect components that rely on that current behavior, so I feel quite scared about the possibility that this behavior could change in the future. I'd like to know what Preact and Inferno think about this so that I could feel confident about relying on that behavior and just drop React support once they decide to ignore the false return value.

    I've been thinking a lot about an autocomplete solution for our application that supports multiple selections, so let me explain why I think this is relevant. One of the approaches I've been considering is to use an structure such as:

    render() {
      return <div className={uniqueComponentClassName}>
        <InputComponent className={uniqueInputClassName} />
        <SelectionDisplay selected={selectedItems} />
        <OptionsMenu onShouldUpdateComponent={_=> false} className={uniqueOptionsMenuClassName} />
      </div>
    }
    

    In componentWillMount I would register some global event handlers that would compare event.target against some known unique css class names. Then I'd like to be able to populate the OptionsMenu with whatever I want knowing that that component would remain untouched by Preact. There are many reasons why this would be interesting. For example, I noticed with our current autocomplete custom component based on jQuery UI that when we have to render thousands of options, using cloneNode instead of createElement can be much faster, specially in some browsers. So, I could decide to use that to generate the menu items, for example. Then, as the items are selected, I'd like to update the state of the autocomplete component so that SelectionDisplay is updated correctly as well as other parts of the applications, but I don't want Preact to touch the content of OptionsMenu. In that case, if we ignore the onShouldUpdateComponent results the component wouldn't just become slower. It wouldn't work correctly at all. That's why I'm concerned if Preact would ever consider ignoring the return value from shouldComponentUpdate. It's a valuable escape hatch, specially when integrating to third party components not managed by the vdom implementation. Does that make sense to you?

    question 
    opened by rosenfeld 46
  • TypeScript definition for preact

    TypeScript definition for preact

    I'm wondering... Would you be interested in participating in TypeScript and all? :D I'm looking into it right now (choosing between it and flowtype) and thinking about creating definiton file. Also there is some movement about flow-type definitions, as I see in their repository. So maybe two definitions will be better. What do you overall think about flow and typescript?

    enhancement help wanted 
    opened by idchlife 43
  • Add Hooks API

    Add Hooks API

    React team just announced new React Hooks API, and I think it will be a worthy addition to Preact.

    The RFC: https://github.com/reactjs/rfcs/pull/68 A blog post at React blog: https://reactjs.org/docs/hooks-intro.html

    enhancement discussion in X 
    opened by kossnocorp 42
  • Support (or document non-support) for Fragments

    Support (or document non-support) for Fragments

    https://github.com/reactjs/reactjs.org/pull/345

    React is adding a top-level React.Fragment export that transpiles to JSX as:

    <>
      <li>Stuff</li>
      <li>Things</li>
    </>
    
    React.createElement(React.Fragment, {}, ...)
    

    Would Preact be able to support fragments or provide some type of fallback?

    in X 
    opened by alexkrolick 41
  • Preact 7 Support for Internet Explorer 11

    Preact 7 Support for Internet Explorer 11

    With preact 6.4.0, my medium-sized React application worked just fine on Internet Explorer 11. With preact 7, I get a "stack overflow" message on IE's web developer console.

    Are there any plans to make preact 7 work with IE11? I can understand that preact only supports modern browsers, but for better or worse, IE11 is a modern browser, and I can't rule out the possibility that my customers use it :-)

    feedback needed discussion 
    opened by pahund 38
  • Text node sometimes duplicated (after initial render) if its preceded by an empty node in IE9-11

    Text node sometimes duplicated (after initial render) if its preceded by an empty node in IE9-11

    This issue seems to have been introduced since 7.0.1. I guess this may be what is causing the tests to fail on Saucelabs (although I can't figure out what test it is from that output).

    Example: http://jsfiddle.net/28ckgyzj/13/

    bug has fix 
    opened by rmales 38
  • How to write tests easily?

    How to write tests easily?

    Are there any guides or best practices how to write unit tests for preact components easily? In the past I was used to use Enzyme to write tests for my React components. Unfortunately Enzyme does not support any libraries other than React itself 😞

    Do you have any tips or library recommendations?

    opened by screendriver 36
  • Preact and Relay

    Preact and Relay

    Hi, I just tried to switch to preact on my relay project using preact-compat, it's compile but I have this error on the console.

    GraphQLStoreChangeEmitter.js:82Uncaught TypeError: this._batchUpdate is not a function at e._processBroadcasts (http://localhost:9000/assets/app.js:31:3416) at http://localhost:9000/assets/app.js:31:3104 at i (http://localhost:9000/assets/app.js:10:19989) at http://localhost:9000/assets/app.js:10:20732 at MutationObserver.r (http://localhost:9000/assets/app.js:13:20214) e._processBroadcasts @ GraphQLStoreChangeEmitter.js:82 (anonymous function) @ GraphQLStoreChangeEmitter.js:63 i @ core.js:37 (anonymous function) @ core.js:123 r @ browser-raw.js:52

    I think preact is awesome, I reduced my gzip bundle from 160k to 124k with it, it's just to bad it's doesn't work. Is there something you can do about it?

    Thanks

    help wanted compat important 
    opened by yasserkaddour 36
  • Infinite loop when upgrading to 5.7.0

    Infinite loop when upgrading to 5.7.0

    My app just keeps re-rendering the first component when I upgraded to 5.7.0, while any previous versions (5.6.0 down to 5.1.0-beta at least) works fine.

    My app uses redux dispatching and some custom transitions modeled after reacts transition groups but it seems like a pretty big regression since they work nicely in older versions.

    bug compat important feedback needed 
    opened by slaskis 35
  • A React renderer without React 18+ API support is being used with React 18+.

    A React renderer without React 18+ API support is being used with React 18+.

    Describe the bug When I call recoil's useRecoilState() I get the following error (however the function seems to be working correctly):

    A React renderer without React 18+ API support is being used with React 18+.

    I don't get any error when I use recoil with React. Perhaps I need to setup more/different paths in tsconfig.json?

    To Reproduce

    Clone the repo and npm install && npm run dev. The problem is here.

    Quick Codesandbox code I made, runs with an error related to a renderer so I assume it's the same issue.

    opened by stitch-05 1
  • types: Add `indeterminate` property

    types: Add `indeterminate` property

    Close #3836

    Not entirely sure this is correct though; this cannot be set via HTML attributes and it doesn't appear that React supports it in JSX either. Not sure what the going practice is for these sorts of situations, but thought I'd open this anyways.

    opened by rschristian 1
  • Typescript:  input property indeterminate is not typed

    Typescript: input property indeterminate is not typed

    Describe the bug When using Preact with typescript, the indeterminate property on checkboxes cannot be set. This is a type-only issue, as the property works correctly in the browser.

    To Reproduce Typescript playground:

    https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAIjFApgQwMYwQbgLABQokscASulnAGZQQiLKUwD0G9YarAzlBroUIsWcAGJpgAG25wYEWQE8wKDAAsVAazgQAdnAAKqTPABSAZQAahADzAdYAK7wYSlAF4EazQCMIADwQ4OwATFBgUKBA7LhQ4FgA+QQJhOAAVVy8MDRlkCGUoSQVtPRh1OFQAcwdJNCg4ABEAeQBZIJ1wqGpMFG5CUIwa1DgAN1q2xxgAUUkALjgACVTmgBkASXsnaZQQFHb8Ig2pyQA6ELCIqJ0Y-aA

    Expected behavior The above code should be accepted by the typechecker.

    opened by nattthebear 3
  • give the internal a stable id based on both depth and initial vnodeId

    give the internal a stable id based on both depth and initial vnodeId

    We currently can't remove _vnodeId as we rely on rotating those to check for strict equality.

    This PR adds a stable identifier when we first create an internal, we base this off of the _vnodeId and the depth of the internal.

    I think this could function as a good replacement to useId

    TODO: we should later on verify with https://github.com/preactjs/preact/pull/2396 whether this still works correctly with depth ordering

    opened by JoviDeCroock 3
Releases(10.11.3)
  • 10.11.3(Nov 14, 2022)

    Bug Fixes

    • Add an explicit default export for compatibility with esbuild (#3783, thanks @Verseth)
    • Fix useId uniqueness with shared parents + DOM nodes in between (#3773, thanks @marvinhagemeister)
    • Fix case where keyed children would get removed (#3779, thanks @JoviDeCroock)
    • Use Object.is in useSyncExternalStore (#3776, thanks @zalishchuk)

    Maintenance

    • Consolidate benchmark workflow steps into a single reusable workflow (#3782, thanks @andrewiggins)
    • Upgrade bench dependencies (#3778, thanks @andrewiggins)
    • Upgrade workflow actions (#3777, thanks @andrewiggins)
    Source code(tar.gz)
    Source code(zip)
    preact-10.11.3.tgz(291.25 KB)
  • 10.11.2(Oct 15, 2022)

  • 10.11.1(Oct 4, 2022)

    Bug Fixes

    • Fix webpack error when trying to import compat/package.json (#3755, thanks @akselander)
    • Fix nested fragments swapped incorrectly on conditional swap (#3738, thanks @JoviDeCroock)
    • Avoid synchronously adding setState callbacks (#3743, thanks @JoviDeCroock)
    • Fix signals not supported in HTML + SVG TypeScript definitions (#3747, thanks @marvinhagemeister)
    • Only remove nested DOM elements on unmount when necessary (#3741, thanks @developit)
    • Don't discard prop updates when nested state update is immediately cancelled (#3739, thanks @JoviDeCroock)
    • Align TypeScript definitions from react to refs and forward refs (#3713, thanks @PodaruDragos)
    • Add missing "types" field for preact/debug (#3732, thanks @marvinhagemeister)
    • Fix falsy data attributes not working (#3720, thanks @JoviDeCroock)
    • Ensure _mask property always has the same name in distributed version (#3721, thanks @JoviDeCroock)
    Source code(tar.gz)
    Source code(zip)
    preact-10.11.1.tgz(292.72 KB)
  • 10.11.0(Sep 12, 2022)

    10.11.0

    New Hook: useId

    Today we are announcing a new hook: useId. This hook creates stable unique identifiers that are consistent between server-side rendering (using preact-render-to-string) and client-side hydration. The useId() hook is primarily useful for generating identifiers for attributes like aria-labelledby and <label for="...">.

    To enable useId() to generate consistent unique identifiers, please ensure you are using preact-render-to-string version 5.2.4 or newer for server-side rendering.

    (#3583, thanks @JoviDeCroock)

    Fixes

    • Fix memory leak by cleaning up _parent, _dom and __hooks after unmount (#3709, thanks @JoviDeCroock)
    • Fix case where the ref property could be omitted from reused VNodes (#3696, thanks @JoviDeCroock)
    • Pass errorInfo to useErrorBoundary callback (#3689, thanks @marvinhagemeister)
    • Fix typescript definition for class | className (#3711, thanks @PodaruDragos)

    Maintenance

    • Fix the mac arm build (#3697, thanks @gengjiawen)
    • Fix published JS formats after #3697 (#3702, thanks @rschristian)
    • Add todo benchmark and add a proxy package that uses preact/hooks (#3708, thanks @JoviDeCroock)
    • Add deprecation notice to render()'s replaceNode argument (#3700, thanks @rschristian)
    • Improve types for bare createElement() and h() calls (#3690, thanks @JoviDeCroock)
    • Add test for useId (#3716, thanks @JoviDeCroock)
    Source code(tar.gz)
    Source code(zip)
    preact-10.11.0.tgz(292.09 KB)
  • 10.10.6(Aug 19, 2022)

  • 10.10.5(Aug 19, 2022)

  • 10.10.4(Aug 18, 2022)

  • 10.10.3(Aug 16, 2022)

  • 10.10.2(Aug 10, 2022)

  • 10.10.1(Aug 5, 2022)

    Bug Fixes

    • Fix infinite loop in radix-ui which enqueues multiple state updates in the same tick (#3645, thanks @JoviDeCroock )
    • Fix effects run for suspended components in rare instances (#3643, thanks @JoviDeCroock )
    • Fix useSyncExternalStore not working with function values (#3633, thanks @marvinhagemeister )
    • Defer bailing out of updates to the render phase to align with React (#3621 + #3623, thanks @JoviDeCroock )
    • Fix some SVG attributes applied with wrong casing (#3615, thanks @iminside)

    Maintenance

    • Update esbuild (#3630, thanks @marvinhagemeister )
    • Make demo compatible with node 16 and 18 (#3617, @gengjiawen )
    Source code(tar.gz)
    Source code(zip)
    preact-10.10.1.tgz(237.26 KB)
  • 10.10.0(Jul 13, 2022)

    Feature


    We changed our debounce of our rendering to setTimeout! Why? We've batched using microtasks for the past few major versions because it benchmarked well. This had a side-effect of flushing batched renders between event handlers, which can cause some strange behavior:

    <input
          type="checkbox"
          onChange={onChange}
          checked={true}
          onClick={onClick}
    />

    

    An additional benefit of this change is that code causing an infinite rendering loop will no longer result in an unresponsive browser tab. Rendering in a loop is now capped to the browser's maximum timer frequency (~250Hz), which makes it possible to pause and debug the code triggering an accidental loop.

    Source code(tar.gz)
    Source code(zip)
    preact-10.10.0.tgz(235.59 KB)
  • 10.9.0(Jul 6, 2022)

    Feature

    We are adding support for the newly added React 18 hooks (apart from useId) (#3568, thanks @JoviDeCroock)

    FIxes

    • Adding types for 'part' attribute (#3595, thanks @rschristian)
    • prevent _suspended and _force from colliding (#3585, thanks @JoviDeCroock)
    Source code(tar.gz)
    Source code(zip)
    preact-10.9.0.tgz(236.35 KB)
  • 10.8.2(Jun 22, 2022)

    Enhancements

    • Add support for svg property shape-rendering (#3577, thanks @DannyvanderJagt)
    • Remove setState on unmounted component warning (#3576, thanks @ekwoka)

    Fixes

    • Fix allow return undefined in useMemo after skipped render (#3580, thanks @marvinhagemeister)
    • Fix incorrect useMemo return value after skipped render (#3579, thanks @marvinhagemeister)
    • Commit hooks in options.diffed (#3578, thanks @JoviDeCroock)
    • restrict "oninputCapture" conversion to just "oninput" vs "oninput*" (#3573, thanks @jramanat-oracle)

    Improvements

    • Improve unit tests to cover fix on #3573 (#3574, thanks @marconi1992)
    • Add _pendingValue to mangle.json (#3575, thanks @marvinhagemeister)
    Source code(tar.gz)
    Source code(zip)
    preact-10.8.2.tgz(234.04 KB)
  • 10.8.1(Jun 16, 2022)

  • 10.8.0(Jun 14, 2022)

    Features

    • Add export maps to the subpackages (#3565, thanks @JoviDeCroock)
    • Ensure both onchange and oninput callbacks are executes when typing (#3562, thanks @marconi1992)
    • Make createRoot / hydrateRoot compatible with React spec (#3560, thanks @3846masa)
    • Implement state settling in X (#3553, thanks @JoviDeCroock)

    Maintenance

    • Fix size CI failing on node version missmatch (#3563, thanks @JoviDeCroock)
    Source code(tar.gz)
    Source code(zip)
    preact-10.8.0.tgz(233.81 KB)
  • 10.7.3(Jun 1, 2022)

  • 10.7.2(May 6, 2022)

    Improvements

    • improve compat types (#3534, thanks @JoviDeCroock)
    • support nodenext in TypeScript 4.7 (#3513, thanks @ilogico)
    • add missing containerInfo to portals (#3508, thanks @JoviDeCroock)

    Fixes

    • fix cleanup of debounceRendering hook after exceptions (#3530, thanks @robertknight)

    Maintenance

    • fix Snyk sponsor link (#3533, thanks @developit)
    • add Snyk to sponsors (#3532, thanks @developit)
    • remove git.io usages (#3528, thanks @mhmdanas)
    • fixes broken Slack shield in README (#3516, thanks @schalkventer)
    Source code(tar.gz)
    Source code(zip)
    preact-10.7.2.tgz(231.33 KB)
  • 10.7.1(Apr 5, 2022)

  • 10.7.0(Mar 29, 2022)

    Features

    • Add support for errorInfo (#3452, thanks @marvinhagemeister )
    • Allow for passing in multiple refs through forwardRef (#3494, thanks @JoviDeCroock)

    Bug Fixes

    • Fix Incorrect translation of xlink:href attribute -> hhref (#3453, thanks @pguilbert)
    • Fix swapped jsx runtime __source and __self arguments (#3459, thanks @marvinhagemeister)
    • Ensure consistent format order for package entries (#3489, thanks @marvinhagemeister)
    • Reset useImperativeHandle ref to null when the component get unmounted (#3487, thanks @deadem)

    Typings

    • Add missing defaultValue and defaultChecked typings (#3464, thanks @ilogico)

    Maintenance

    • Fix test not cleaned up properly (#3457, thanks @marvinhagemeister
    • Fix fake timers not being reset on test failure (#3458, thanks @marvinhagemeister)
    • Remove unused devDependency (#3460, thanks @marvinhagemeister)
    • Update test dependencies (#3467, thanks @marvinhagemeister)
    • Improve karma test console logging (#3475, thanks @marvinhagemeister)
    • Fix karma error traces not being source mapped (#3476, thanks @marvinhagemeister)
    Source code(tar.gz)
    Source code(zip)
  • 10.6.6(Feb 14, 2022)

  • 10.6.5(Jan 27, 2022)

    Fixes

    • fix effect ordering (#3416, thanks @JoviDeCroock)
    • Normalize CompositionEvent listeners in preact/compat (#3430, thanks @hpneo)

    Types

    • Change type of for better TypeScript compatibility with @emotion/react and @types/react. (#3431, thanks @rolftimmermans)

    Maintenance

    • Use onInput instead of onChange in the README example (#3420, thanks @matthiask)
    • remove malfunctioning csb ci (#3417, thanks @JoviDeCroock)
    • Fix instructions for npm tag in CONTRIBUTING (#3380, thanks @andrewiggins)
    • Fix typo in release workflow (#3379, thanks @andrewiggins)
    • Automate building npm package for release (#3378, thanks @andrewiggins)
    Source code(tar.gz)
    Source code(zip)
  • 10.6.4(Dec 9, 2021)

  • 10.6.3(Dec 8, 2021)

    Fixes

    • Fire useEffect in reverse component depth order (#3354, thanks @developit)
    • Map onFocus/onBlur to onfocusin/onfocusout (#3355, thanks @developit)

    Maintenance

    • Add test for useEffect ordering with useMemo (#3360, thanks @andrewiggins)
    Source code(tar.gz)
    Source code(zip)
  • 10.6.2(Nov 29, 2021)

    Fixes

    • Handle hooks that throw during cleanup (#3345, thanks @JoviDeCroock)
    • Include all package.json files in the export-maps (#3344, thanks @developit)
    Source code(tar.gz)
    Source code(zip)
  • 10.6.1(Nov 25, 2021)

    Fixes

    • Fix switch check for excessDomChildren (fixes IE11) (#3342, thanks @JoviDeCroock)

    Maintenance

    • Fix es5 warnings in local test runs (#3340, thanks @developit)
    Source code(tar.gz)
    Source code(zip)
  • 10.6.0(Nov 23, 2021)

    Types

    • Adjust raf types (#3323, thanks @JoviDeCroock)
    • Suggest fix for useRef-types in hooks (#3222, thanks @JoviDeCroock)
    • Add component props to compat exports (#3321, thanks @JoviDeCroock)

    Fixes

    • Fix className leak (#3279, thanks @JoviDeCroock)
    • Support hydrating html comments (#3327, thanks @JoviDeCroock)

    Maintenance

    • Fix tests in IE11 (#3264, thanks @developit)
    • Add jsx(-dev)-runtime to the export maps (#3320, thanks @JoviDeCroock)
    Source code(tar.gz)
    Source code(zip)
  • 10.5.15(Oct 12, 2021)

    Fixes

    • Skip rendering
    • Nested Suspended trees may be missing _children (#3260, thanks @developit)
    • Manage camel-cased dominant-baseline attribute in preact/compat (#2859, thanks @nmondon)
    • Restrict camelCase prop renaming to non-custom elements (#3259, thanks @jramanat-oracle)
    • Fix bug in chrome where select values continuously rerender (#3226, thanks @JoviDeCroock)
    • Avoid leaking internal vnodes (#3106, thanks @developit)

    Types

    • Fix ref typing of forwardRef (#3214, thanks @itkrt2y)
    • Add focusin & focusout to type definitions (#3257, thanks @boarwell)
    • Add onBeforeInput attribute to type definitions (#3256, thanks @boarwell)
    • Add missed HTML attributes in the TS typings (#3246, thanks @rschristian)

    Maintenance

    • Update babel.config.js (#3265, thanks @RRDAWLX)
    • Delete redundant previousComponent in hooks (#3271, thanks @RRDAWLX)
    • Update test dependencies (#3255, thanks @marvinhagemeister)
    Source code(tar.gz)
    Source code(zip)
  • 10.5.14(Jul 1, 2021)

    Features

    • Compat: Add flushSync (#3094, thanks @zephraph)

    Bug Fixes

    • Prevent eager child removal (#3210, thanks @JoviDeCroock)
    • Compat: Update Fake React Version (#3189, thanks @tim-on-github)
    • Fix react-spring error caused by augmented function contexts (#3165, thanks @developit)
    • Use Array.prototype.slice.call for children arguments (#3143, thanks @fzzle)
    • Improve performance of vnodeId generation (#2978, thanks @developit)
    • Fix: should override children if null is provided as an argument (#3091, thanks @clyfish)

    Size

    • refactor(diff-index): reuse i to reduce size (-32b) (#3193, thanks @liuarui)
    • Simplify unmount logic (#3120, thanks @andrewiggins)

    Typings

    • Fix type definitions (#3191, thanks @craftedsystems)
    • Fix undefined initializer case for useState type (#3185, thanks @rschristian)
    • Make typings deno compatible (#3079, thanks @lucacasonato)
    • Change typing of event.this to be never (#3147, thanks @JoviDeCroock)
    • Update signature of lazy to reflect behavior (#3139, thanks @JonasKruckenberg)
    • Improve typing of forwardRef (#3144, thanks @cmlenz)
    • Fix the useRef typing to include undefined when called without initial value (#3056, thanks @cmlenz)

    Maintenance

    • Docs: Removing suggestion to install Preact CLI (#3204, thanks @rschristian)
    • Upgrade karma-esbuild to support M1 chips (#3153, thanks @marvinhagemeister)
    • Rely directly on performance.now (#3130, thanks @developit)
    • Add The Guardian as a Github backer (#3086, thanks @mchv)
    • Fix typo in issue template (#3067, thanks @rschristian)
    Source code(tar.gz)
    Source code(zip)
  • 10.5.13(Mar 14, 2021)

    Bug Fixes

    • Fix unable to reset tabIndex (#3062 + #3064, thanks @marvinhagemeister)
    • Add ESM entry for compat/server (#3059 + #3061, thanks @marvinhagemeister)
    • Fix unable to render bigint numbers (#3010, thanks @marvinhagemeister)
    • Fix reordering issue of memoized component when the component initially render null (#2988, thanks @tanhauhau)

    Types

    • Add decoding attribute (#3054, thanks @sumanthratna)
    • Add missing SVGFEFunc types (#3043, thanks @rschristian)

    Maintenance

    • Update issue templates (#3058, thanks @marvinhagemeister)
    • Update esbuild to natively support Apple's M1 chip (#3028, thanks @marvinhagemeister)
    • Create separate trace log directories per benchmark (#3024, thanks @andrewiggins)
    • Reduce redundant preparation in bench scripts (#3013, thanks @andrewiggins)
    • Tests: Fix stale watch cache (#3012, thanks @marvinhagemeister)
    • Tests: Reduce CPU usage in watch mode (#3011, thanks @marvinhagemeister)
    • Tests: Fix Chrome 88 stack traces displayed wrong in terminal (#3008, thanks @marvinhagemeister)
    • Upgrade tachometer and add script to analyze browser trace logs (#3005, thanks @andrewiggins)
    • Use options.unmount instead of overriding component.componentWillUnmount (#2919, thanks @tanhauhau)
    • Update esbuild + karma-esbuild (#2991, thanks @marvinhagemeister)
    • Add a few minor tests (#2981, thanks @43081j)
    Source code(tar.gz)
    Source code(zip)
  • 10.5.12(Jan 26, 2021)

    This release includes an enhancement to our devtools integration. Via a babel plugin you can get more readable hook names to show up in devtools instead of dozens of useState hooks in devtools. Check out https://github.com/preactjs/babel-plugin-transform-hook-names for more information.

    Before:

    image

    After:

    image

    Bug Fixes

    • Compat: Fix defaultValue not applied when value==null/undefined (#2957, thanks @marvinhagemeister)
    • Fix HTML comments breaking hydration (#2956, #2960 thanks @marvinhagemeister and @developit)

    Maintenance

    • Tests: Improve console.logs (#2959, thanks @marvinhagemeister)
    • Remove redundant benchmark initialization (#2966, thanks @andrewiggins)
    • Fix pr-reporter condition (#2964, thanks @andrewiggins)
    • Report benchmarks on PRs from forks (#2961, thanks @andrewiggins)
    • Update size action to only run when src files change (#2962, thanks @andrewiggins)
    • Use artifact flow to report benchmarks results (#2953, thanks @andrewiggins)
    Source code(tar.gz)
    Source code(zip)
Owner
Preact
Fast 3kB alternative to React with the same modern API.
Preact
:fire: An extremely fast, React-like JavaScript library for building modern user interfaces

Inferno is an insanely fast, React-like library for building high-performance user interfaces on both the client and server. Description The main obje

Inferno 15.6k Jan 3, 2023
Next-generation DOM manipulation

Ractive.js - Next-generation DOM manipulation Have any questions or just want to chat? Join us on GitHub Discussions! What is Ractive.js? It's a JavaS

Ractive.js 5.9k Jan 4, 2023
🌟 DataFormsJS 🌟 A minimal JavaScript Framework and standalone React and Web Components for rapid development of high quality websites and single page applications.

?? Welcome to DataFormsJS! Thanks for visiting! ?? ?? ?? ?? ?? ?? 中文 (简体) 欢迎来到 DataFormsJS Español Bienvenido a DataFormsJS Português (do Brasil) Bem

DataFormsJS 156 Dec 8, 2022
Plain functions for a more functional Deku approach to creating stateless React components, with functional goodies such as compose, memoize, etc... for free.

"Keo" is the Vietnamese translation for glue. Plain functions for a more functional Deku approach to creating stateless React components, with functio

Adam Timberlake 225 Sep 24, 2022
A collection of awesome derby components

Awesome Derby ============= A collection of awesome derby components Awesome Derby Information Components Information derby - MVC framework making it

Ruslan 14 Sep 24, 2022
Formily + SemiDesign: The Awesome Components Library with Formily & Semi

Formily + SemiDesign: The Awesome Components Library with Formily & Semi

Formily Organization 12 Dec 19, 2022
NativeScript empowers you to access native api's from JavaScript directly. Angular, Vue, Svelte, React and you name it compatible.

NativeScript empowers you to access native APIs from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile de

NativeScript 22k Jan 4, 2023
An HTML5/CSS3 framework used at SAPO for fast and efficient website design and prototyping

Welcome to Ink Ink is an interface kit for quick development of web interfaces, simple to use and expand on. It uses a combination of HTML, CSS and Ja

SAPO 1.9k Dec 15, 2022
Blazing fast Apple TV application development using pure JavaScript

atvjs Blazing fast Apple TV application development using pure JavaScript. Philosophy What's included Getting Started Basic Examples Creating Pages Ad

Emad Alam 292 Dec 14, 2022
A framework for building native apps with React.

React Native Learn once, write anywhere: Build mobile apps with React. Getting Started · Learn the Basics · Showcase · Contribute · Community · Suppor

Facebook 106.8k Jan 3, 2023
Functional, simple and customizable UI buttons for react native. Also contains loading functionality and automatically changes color for dual tone buttons. TypeScript support.

React Native UI Buttons ✨ Installation If you want to use icons make sure you have react-native-vector-icons installed in your project. npm install --

Hussain Pettiwala 6 Dec 5, 2022
Brail is a framework built on NextJS for developing email templates in React, and returning HTML that is compatible with major email clients.

Brail is a framework built on NextJS for developing email templates in React, and returning HTML that is compatible with major email clients. It aims to seperate the concerns of generating the emails and delivering them.

null 121 Jan 2, 2023
An unofficial SmartThings websocket API library (alpha)

An unofficial SmartThings websocket API library (alpha) ?? Installation This is a Node.js module available through the npm registry. $ npm i -S smart-

Stephen Mendez 4 Sep 20, 2021
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.

Fast 3kB alternative to React with the same modern API. All the power of Virtual DOM components, without the overhead: Familiar React API & patterns:

Preact 33.5k Dec 31, 2022
⚡️The Fullstack React Framework — built on Next.js

The Fullstack React Framework "Zero-API" Data Layer — Built on Next.js — Inspired by Ruby on Rails Read the Documentation “Zero-API” data layer lets y

⚡️Blitz 12.5k Jan 4, 2023
A Fast & Light Virtual DOM Alternative

hyper(HTML) ?? Community Announcement Please ask questions in the dedicated discussions repository, to help the community around this project grow ♥ A

Andrea Giammarchi 3k Dec 30, 2022
⏰ Day.js 2KB immutable date-time library alternative to Moment.js with the same modern API

English | 简体中文 | 日本語 | Português Brasileiro | 한국어 | Español (España) | Русский Fast 2kB alternative to Moment.js with the same modern API Day.js is a

null 41.7k Dec 28, 2022
⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API

English | 简体中文 | 日本語 | Português Brasileiro | 한국어 | Español (España) | Русский Fast 2kB alternative to Moment.js with the same modern API Day.js is a

null 41.7k Dec 28, 2022