12 2020 档案

摘要:最基本的使用 首先,举一个简单的例子: import React, { useState } from 'react'; function App() { const [data, setData] = useState({ hits: [] }); return ( <ul> {data.hits 阅读全文
posted @ 2020-12-22 13:16 axl234 阅读(1024) 评论(0) 推荐(0)
摘要:React 16 提供一个内置函数 componentDidCatch,如果 render() 函数抛出错误,则会触发该函数。 举个例子 class ErrorBoundary extends React.Component { constructor(props) { super(props); 阅读全文
posted @ 2020-12-21 09:12 axl234 阅读(333) 评论(0) 推荐(0)
摘要:creat-react-app 初始化项目后,我们对项目的启动是通过 react-scripts 实现的,项目开发过程中,如果需要引入对less 支持,和高阶组件对装饰器的使用,我们需要在webpack 中添加对此功能的支持,我们需要custom-cra 这个包,https://www.npmjs. 阅读全文
posted @ 2020-12-19 16:12 axl234 阅读(1886) 评论(0) 推荐(0)