This commit is contained in:
2022-05-01 19:27:52 +08:00
parent be1547c9ad
commit ef97468194
390 changed files with 0 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
<!--
* @Author: chenxuan
* @Date: 2022-01-15 19:51:19
* @LastEditTime: 2022-01-15 19:56:39
* @LastEditors: chenxuan
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app"></div>
<script src="../package/old/react.development.js"></script>
<script src="../package/old/react-dom.development.js"></script>
<script src="../package/old/babel.min.js"></script>
<script type="text/babel">
class Time extends React.Component{
state={date:new Date()}
render(){
return (
<div>
<h1>hello!</h1>
<input type="text"/>
<span>现在是:{this.state.date.toTimeString()}</span>
</div>
)
}
componentDidMount(){
setInterval(()=>{
this.setState({date:new Date()})
},1000)
}
}
ReactDOM.render(<Time/>,document.getElementById('app'))
</script>
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
1、diffing算法
2、循环时key的作用
在更像时起着重要作用
3、index作为key的问题
造成不必要的更新,资源浪费
含有输入框的节点可能会导致错乱