Controlled Components
摘要:【Controlled Components】 In HTML, form elements such as <input>, <textarea>, and <select> typically maintain their own state and update it based on use
阅读全文
Handling Event
摘要:【Handling Event】 1、React events are named using camelCase 2、You must call preventDefault explicitly to prevent default behaviour 3、define callback in
阅读全文
State
摘要:【State】 1、componentDidMount The componentDidMount() hook runs after the component output has been rendered to the DOM. This is a good place to set up
阅读全文
props
摘要:【props】 elements can also represent user-defined components: When React sees an element representing a user-defined component, it passes JSX attribute
阅读全文
Functional and Class Components
摘要:【Functional and Class Components】 The simplest way to define a component is to write a JavaScript function: This function is a valid React component b
阅读全文
Babel
摘要:【Babel】 1、babel有非常多的版本,可以通过多种方式引用,在链接1中可以查看到所有支持的版本。 2、对node版本的安装与使用,分以下几步: 1)install 2)使用transform api 转换代码 3)安装preset In order to enable the preset
阅读全文
React
摘要:【搭建React环境】 create-react-app 是一个帮助快速搭建 react 工程的 bin。通过npm可以安装。 You don’t need to install or configure tools like Webpack or Babel. They are preconfig
阅读全文