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

preact icon

Using addEventListener in Preact

12 Jun, 2024
This example demonstrates how to add and properly clean up event listeners in a Preact functional component using the useEffect hook. A button element is referenced using useRef, and event listeners...
preact icon

Install Preact

12 Jun, 2022
Installing Preact two ways shown. At first the official way did not work for me. I had to fix permissions for the global node modules, official solution. Then the alternative way worked, and after...