Description
pion brings React's hooks API to standard web components. It works with lit-html or hyperHTML and is forked from the haunted library. Developers write components as functions and use hooks with the same names React uses, including useState, useEffect, useReducer, useRef, useContext and useMemo. The project says hooks from npm can be reused by aliasing package names in the bundler config. Observed attributes that map to native reflected properties, such as aria attributes, title, lang and dir, cause a re-render when they change, and the renderer can read the attribute value with getAttribute. The README links to the full documentation and to more example integrations in a gist. The project is public on GitHub and released under the BSD-2-Clause license.…
Highlights
- React-style hooks for web components
- useState, useEffect, useReducer and more
- Works with lit-html or hyperHTML
- Re-renders when aria, title, lang or dir change
Ratings & Reviews
No ratings yet
Be the first to rate pion.
People also visit
pion FAQ
What is pion?
A library that implements React's hooks API for standard web components, using lit-html or hyperHTML as the renderer.
Can I reuse React hooks from npm?
The README says you can, by aliasing the package names in your bundler config, because pion supports the same hooks API.
Which hooks are supported?
The README lists useCallback, useContext, useEffect, useHost, useLayoutEffect, useMemo, useProperty, useReducer, useRef and useState.
What license is it under?
The repository states the BSD-2-Clause license.
What are the best pion alternatives?
Popular alternatives to pion include haunted, @tryvital/vital-link and How to use Web Components in React. See all pion alternatives














