摘要: 1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <t 阅读全文
posted @ 2021-02-04 16:15 不秃头的代码狗 阅读(53) 评论(0) 推荐(0)
摘要: /* 1.初始化阶段:由ReactDOM.render()触发(初次渲染的时候) 1.construtor() 2.conponentWillMount() 3.render() 4.componentDidMount() 2.由组件内部this.setState()或父组件render触发 1.s 阅读全文
posted @ 2021-01-19 19:28 不秃头的代码狗 阅读(68) 评论(0) 推荐(0)
摘要: 1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <t 阅读全文
posted @ 2021-01-15 15:21 不秃头的代码狗 阅读(219) 评论(0) 推荐(0)
摘要: //类式组件的props校验方法 1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta name="viewport" content="width=device-width, initial 阅读全文
posted @ 2021-01-14 20:46 不秃头的代码狗 阅读(241) 评论(0) 推荐(0)
摘要: 1.每个组件对象都会有props 2.每个组件对象的属性都会保存在props中 3.props只读属性不可以直接修改 //函数组件传入props 1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <m 阅读全文
posted @ 2021-01-14 18:47 不秃头的代码狗 阅读(108) 评论(0) 推荐(0)
摘要: 函数式组件与类式组件 //函数式组件<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" 阅读全文
posted @ 2021-01-14 17:28 不秃头的代码狗 阅读(129) 评论(0) 推荐(0)
摘要: 使用constructor来初始化state和手动改变自定义方法的this指向 class Study extends React.Component{ constructor(props){ super(props) this.state = {isS:false}; this.changeSta 阅读全文
posted @ 2021-01-13 18:00 不秃头的代码狗 阅读(156) 评论(0) 推荐(1)
摘要: 定义虚拟dom时,不要用引号。 标签中混入JS的表达式时用{} 样式指定类名class替换成className 内联样式,需要用style={{key:value}}的形式去写 只有一个根节点 标签必须闭合 标签首字母 小写字母开头,识别成html标签同名标签,无则报错 大写字母开头,识别成reac 阅读全文
posted @ 2021-01-13 17:35 不秃头的代码狗 阅读(54) 评论(0) 推荐(1)