20.5.26 • Published 3 years ago

@web-mjs/preact v20.5.26

Weekly downloads
-
License
MIT
Repository
github
Last release
3 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

3 years ago

20.5.25

3 years ago

20.5.26

3 years ago

20.5.23

3 years ago

20.5.24

3 years ago

20.5.21

3 years ago

20.5.22

3 years ago

20.5.20

3 years ago

20.5.17

3 years ago

20.5.18

3 years ago

20.5.16

3 years ago

20.5.14

3 years ago

20.5.15

3 years ago

21.5.13

3 years ago

20.5.13

3 years ago

10.5.13

3 years ago