Skip to content

Commit

Permalink
Fix useEffect example in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
localvoid committed May 27, 2023
1 parent 1eccb41 commit 9d58f86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/ivi/src/client/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1591,16 +1591,16 @@ export type Effect = {
* @example
*
* const Example = component((c) => {
* const [count, setCount] = useState(0);
* const timer = useEffect(c, shallowEq, ({ interval }) => {
* const [count, setCount] = useState(c, 0);
* const timer = useEffect(c, ({ interval }) => {
* const tid = setInterval(() => { setCount(count() + 1); }, interval);
* return () => { clearInterval(tid); };
* });
* }, shallowEq);
*
* return (interval) => (
* timer({ interval }),
*
* htm`span.Counter ${i}`
* htm`<span>${count()}</span>`
* );
* });
*
Expand Down

0 comments on commit 9d58f86

Please sign in to comment.