
React
小菜101
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
掌握React的基本使用,重塑前端开发
1. Handling Events Html中处理添加事件: <a href="#" onclick="console.log('The link was clicked.'); return false"> Click me </a> React中: function ActionLink() { function handleClick(e) { ...原创 2020-05-07 14:38:39 · 219 阅读 · 0 评论 -
搞懂React的state和生命周期函数(lifecycle methods)
State and Lifecycle 何谓state A component needs state when some data associated with it changes over time. For example, a Checkbox component might need isChecked in its state, 组件内部涉及的数据会根据时间条件变化 随...原创 2020-04-29 16:04:59 · 547 阅读 · 0 评论 -
Components make life easier(组件复用让生活更美好)
Components and Props Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen. Co...原创 2020-04-28 14:56:15 · 198 阅读 · 0 评论 -
React的渲染element(做最少的DOM操作)
Rendering Elements An element describes what you want to see on the screen. 原则:尽可能少的操作DOM 如下面react官网的例子就是很好的说明: function tick() { const element = ( <div> <h1>Hello, world!<...原创 2020-04-28 10:03:04 · 464 阅读 · 0 评论 -
React中的JSX和React elements的概念
Introducing JSX JSX语法实际上是在创建对象,产生的对象称为React elements; 对这些React elements进行渲染,构建出DOM const element = ( <h1 className="greeting"> Hello, world! </h1> ); // => 等于如下写法: const e...原创 2020-04-27 20:02:40 · 750 阅读 · 0 评论