import { h } from 'preact'; import { useEffect, useState } from "preact/hooks"; // Note: `user` comes from the URL, courtesy of our router const Profile = ({ user }) => { const [time, setTime] = useState(Date.now()); const [count, setCount] = useState(10); useEffect(() => { let timer = setInterval(() => setTime(Date.now()), 1000); return () => clearInterval(timer); }, []); return (

Profile: {user}

This is the user profile for a user named {user}.

Current time: {new Date(time).toLocaleString()}

{' '} Clicked {count} times.

); } export default Profile;