Skip to content

Commit 52cb719

Browse files
Update test.md
1 parent ad75cd6 commit 52cb719

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

blog/test.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,27 @@ featuredpath: img/post
99
draft: false
1010
showtoc: true
1111
---
12-
## Test
12+
## Test
13+
14+
```jsx live
15+
function Clock(props) {
16+
const [date, setDate] = useState(new Date());
17+
useEffect(() => {
18+
const timerID = setInterval(() => tick(), 1000);
19+
20+
return function cleanup() {
21+
clearInterval(timerID);
22+
};
23+
});
24+
25+
function tick() {
26+
setDate(new Date());
27+
}
28+
29+
return (
30+
<div>
31+
<h2>It is {date.toLocaleTimeString()}.</h2>
32+
</div>
33+
);
34+
}
35+
```

0 commit comments

Comments
 (0)