随笔分类 -  react篇

摘要:一、使用useRef控制 import React ,{useState, useRef} from 'react' import './App.css'; function App() { const [count ,setCount] = useState(0) const flag = use 阅读全文
posted @ 2023-09-07 15:45 IT小姐姐 阅读(599) 评论(0) 推荐(0)
摘要:父组件中: import React ,{useState, createContext} from 'react' import './App.css'; import ChildOne from './components/ChildOne'; import ChildTwo from './c 阅读全文
posted @ 2023-09-07 14:16 IT小姐姐 阅读(53) 评论(0) 推荐(0)
摘要:useEffect(async () => { const getFirstResponse = async () => { try { return await axios.get('http://first-api', { params: { carId: id }, }); } catch ( 阅读全文
posted @ 2023-08-27 13:19 IT小姐姐 阅读(245) 评论(0) 推荐(0)
摘要:一、子传父 父组件中: import React,{useState } from "react"; import HeXiaoDialog from "../components/hexiaoDialog"; //引入的子组件 function ShuoMing(props){ let [flag 阅读全文
posted @ 2023-08-20 21:10 IT小姐姐 阅读(518) 评论(0) 推荐(0)
摘要:通常我们引入图片的方式: <img src=' ' alt=' ' /> 但是在react项目中这样引入的话图片会加载不出来 react项目中引入图片的方式有两种: 第一种:组件的方式引入 import Img from '../img/d1.jpg' <img src={Img} alt='' / 阅读全文
posted @ 2023-03-24 10:42 IT小姐姐 阅读(61) 评论(0) 推荐(0)
摘要:在react项目中使用ECharts,建议多看几遍官网,从官网的示例中复制代码即可实现简单的图形。 官网地址:https://echarts.apache.org/zh/index.html 1、下载echarts npm install echarts --save 2、在需要的页面引入或者可以封 阅读全文
posted @ 2021-06-10 14:29 IT小姐姐 阅读(4593) 评论(0) 推荐(0)
摘要:答案:运行 npm run eject 即可出现config文件夹 原因: 在package.json中:只有三个依赖,分别是react,react-dom,react-scripts,依赖为什么这么少,是因为像webpack,babel等等都是被creat react app封装到了react-s 阅读全文
posted @ 2021-06-03 15:25 IT小姐姐 阅读(1644) 评论(2) 推荐(0)