Skip to content

Commit e1c4b65

Browse files
committed
emmm
1 parent 8bc8bd7 commit e1c4b65

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

demo/src/time-slicing.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { useState, memo, h, render, useEffect } from "../../src/index"
21

3-
// 注入样式(包含CSS动画)
2+
import { useState, memo, render, useEffect,h } from "fre"
3+
// import { useState, memo, render, useEffect } from "preact/compat"
4+
// import {h} from 'preact' // Using Preact, you can see how the main thread gets blocked.
5+
46
const styleSheet = document.createElement("style")
57
styleSheet.textContent = `
68
.container {
@@ -58,11 +60,11 @@ const SlowDot = memo(({ x, y, size, text }) => {
5860
)
5961
})
6062

61-
// Sierpinski 三角形组件
6263
const targetSize = 25
6364

6465
const getValue = (key, kid) => {
65-
const number = kid.props.nodeValue
66+
console.log(kid)
67+
const number = kid?.props?.nodeValue||kid
6668
return number
6769
}
6870

@@ -97,11 +99,9 @@ const SierpinskiTriangle = memo(({ x, y, s, children }) => {
9799
)
98100
})
99101

100-
// 主应用组件
101102
const App = () => {
102103
const [seconds, setSeconds] = useState(0)
103104

104-
// 仅更新秒数
105105
useEffect(() => {
106106
const timer = setInterval(() => {
107107
setSeconds(prev => (prev % 10) + 1)
@@ -122,5 +122,4 @@ const App = () => {
122122
)
123123
}
124124

125-
// 渲染入口
126125
render(<App />, document.body)

0 commit comments

Comments
 (0)