diff --git a/就业篇/02. 第二章/2-24. Update/Update.md b/就业篇/02. 第二章/2-24. Update/课件资料/Update.md similarity index 100% rename from 就业篇/02. 第二章/2-24. Update/Update.md rename to 就业篇/02. 第二章/2-24. Update/课件资料/Update.md diff --git a/就业篇/02. 第二章/2-24. Update/课堂代码/App.js b/就业篇/02. 第二章/2-24. Update/课堂代码/App.js new file mode 100644 index 0000000..e4e3d0d --- /dev/null +++ b/就业篇/02. 第二章/2-24. Update/课堂代码/App.js @@ -0,0 +1,68 @@ +// 示例一 + +// import React, { useState } from "react"; + +// // 该组件的渲染是非常耗时的 +// function ExpensiveCom() { +// const now = performance.now(); +// while (performance.now() - now < 200) {} +// return
耗时的组件
; +// } + +// function Input() { +// // 维护了一组数据 +// const [num, updateNum] = useState(0); + +// return ( +// <> +// updateNum(e.target.value)} /> +//num is {num}
+// > +// ); +// } + +// function App() { +// return ( +// <> +// +//耗时的组件
; +} + +function Counter({ children }) { + const [num, updateNum] = useState(0); + return ( +num is {num}
+ {children} +