unistore sucks i think
This commit is contained in:
1 parent
baeaead650
commit
02aadcf2db
21 files changed
+4468
-1354
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { h } from 'preact';
|
||||
import { useEffect, useState } from 'preact/hooks';
|
||||
import style from './style.less';
|
||||
|
||||
interface Props {
|
||||
user: string;
|
||||
}
|
||||
|
||||
const Profile = ({ user }: Props) => {
|
||||
const [time, setTime] = useState<number>(Date.now());
|
||||
const [count, setCount] = useState<number>(0);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
let timer = setInterval(() => setTime(Date.now()), 1000);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div class={'profile'}>
|
||||
<h1>Profile: {user}</h1>
|
||||
<p>This is the user profile for a user named { user }.</p>
|
||||
|
||||
<div>Current time: {new Date(time).toLocaleString()}</div>
|
||||
|
||||
<p>
|
||||
<button onClick={() => setCount((count) => count + 1)}>Click Me</button>
|
||||
{' '}
|
||||
Clicked {count} times.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Profile;
|
||||
Reference in new issue
Block a user