React 备忘清单
===
[](https://npmjs.org/package/react)
[](https://www.npmjs.com/package/react)
[](https://github.com/facebook/react/network/dependents)
[](https://github.com/facebook/react)
适合初学者的综合 React 备忘清单
入门
----
### 介绍
React 是一个用于构建用户界面的 JavaScript 库
- [React 官方文档](https://reactjs.org/) _(reactjs.org)_
- [Styled Components 备忘清单](./styled-components.md) _(jaywcjlove.github.io)_
- [TypeScript JSX 备忘清单](./typescript.md#jsx) _(jaywcjlove.github.io)_
```js
import {createRoot} from 'react-dom/client'
import App from './App'
```
-----
```jsx
const elm = document.getElementById('app')
const root = createRoot(elm);
root.render(
您点击了 {count} 次
您点击了 {count} 次
``` #### Class 中的 State ```jsx {6,12,20} import React from 'react'; class Student extends React.Component { constructor(props) { super(props); this.state = {count: 1}; // 确保函数可以访问组件属性(ES2015) this.click = this.click.bind(this); } click() { const count = this.state.count; this.setState({ count: count + 1}) } render() { return (您点击了{this.state.count}次
您点击了{this.state.count}次
``` ### 循环 ```jsx const elm = ['one', 'two', 'three']; function Student() { return (