20.5.26 • Published 4 years ago

@web-mjs/preact v20.5.26

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago
import { render, html, useState, useEffect } from 'https://unpkg.com/@web-mjs/preact';

const App = () => {
   const [clicks, setClicks] = useState(0);
   useEffect(() => {
     document.title = "Clicks: " + clicks;
   });

   return html`<button onClick=${() => setClicks((x) => x + 1)}>Click</button>`;
};

The module bundles preact, preact/hooks, html template and preact-custom-element. The full list of exported members:

  • h, html, render
  • createElement, cloneElement, isValidElement
  • Fragment, Component, createContext, hydrate, options
  • hooks: useReducer, useState, useEffect, useLayoutEffect, useRef, useCallback, useContext, useDebugValue, useErrorBoundary

Web Components

The registerCustomElement function from preact is exported as:

import { webComponents } from 'https://unpkg.com/@web-mjs/preact';

webComponents.register(SomeComponent, 'x-some-tag');

🚧 web-mjs is not affiliated with the Preact team. To build on your own, use rollup or npm run build

20.5.19

4 years ago

20.5.25

4 years ago

20.5.26

4 years ago

20.5.23

4 years ago

20.5.24

4 years ago

20.5.21

4 years ago

20.5.22

4 years ago

20.5.20

4 years ago

20.5.17

4 years ago

20.5.18

4 years ago

20.5.16

4 years ago

20.5.14

4 years ago

20.5.15

4 years ago

21.5.13

4 years ago

20.5.13

4 years ago

10.5.13

4 years ago