
react
实践是最好的老师
2017七月份毕业于南昌航空大学,在深圳从事web前端
展开
-
vue3富文本插件,vue2富文本插件,react富文本插件
富文本插件原创 2024-01-25 17:08:40 · 449 阅读 · 0 评论 -
引入antd css样式失效
当我去掉 webpack.config.js配置css-loader option选项的modules:true时样式生效了。 (去掉下面代码红色部分){loader: ‘css-loader’,options: {modules: true}},原创 2021-10-30 23:00:56 · 705 阅读 · 0 评论 -
手动搭建webpack5 react17项目
git 地址https://github.com/yexianli/react17webapck5原创 2021-11-06 19:14:11 · 246 阅读 · 0 评论 -
react函数组件节流demo,引用了lodash节流方法
import ‘./header.less’import React, { useState, useEffect, useRef } from ‘react’;const dataArr = [{ name: ‘hello’ }, { name: ‘hello’ }, { name: ‘hello’ }, { name: ‘hello’ }, { name: ‘hello’ }, { name: ‘hello’ }, { name: ‘hello’ }, { name: ‘hello’ }, { na原创 2021-11-27 11:50:25 · 1006 阅读 · 0 评论 -
react路由配置
react路由配置,react-router中文文档link原创 2021-11-30 18:59:27 · 401 阅读 · 0 评论 -
componentWillUnmount不生效
生命周期不生效,可以通过点击事件执行卸载生命周期的方法原创 2021-12-24 18:26:35 · 1932 阅读 · 0 评论 -
修复react-native PanResponder包裹的子元素点击事件无法响应
https://stackoverflow.com/questions/47568850/touchableopacity-with-parent-panresponder原创 2022-01-10 17:43:10 · 1146 阅读 · 0 评论 -
expected a string (for built-in components) or a class/function (for composite components) but got:
当时我的解决方法是因为我render里面最外层使用了React.Fragment,将其换成dev就没有这个报错了原创 2022-01-26 16:03:53 · 1234 阅读 · 0 评论 -
react导入img图片
在含有whiteArrowLeft.svg图片文件夹內新建index.js内容为export const whiteArrowLeft =require('./whiteArrowLeft.svg');然后在react组件import { whiteArrowLeft } from ‘…/…/svg/live’ //刚才所建index.js的路径原创 2022-02-15 10:03:56 · 582 阅读 · 0 评论 -
react props数据更改传到方法里进行渲染html,当父组件改变props改变传入函数参数没有改变
解决方法深拷贝一下需变动的数组,因为如果不拷贝map改变了数组(数组里的元素为引用类型),而react禁止改变props getOnlineData = (roommates, onlineRoommates) => { const newRoommates =JSON.parse(JSON.stringify(roommates)) return (newRoommates.map(item => { onlineRoommates.map(element =&原创 2022-02-08 15:58:07 · 1157 阅读 · 0 评论 -
react ant-design表单获取不到Select值或者初始化默认值不生效(封装的表单元素值)
<GftSearch onChange={(data) => { console.log('data',data) }}onChange给 GftSearch组件就好了,然后在GftSearch里面的onChange里面调用this.props.onChange(value) // value是onChange回调的value原创 2022-01-19 15:36:02 · 2537 阅读 · 0 评论 -
antd Form.item initialValue值变化表单初始值却没有更新
解决方案如图第三点,图片内容来源于antd design官网原创 2022-04-26 12:18:58 · 953 阅读 · 0 评论 -
react使用mobx6 store变化组件没有更新
store.js文件解决方法用mobx-react-lite的observer包裹我们组件就可以驱动组件更新了组件引入原创 2022-06-01 16:06:56 · 1127 阅读 · 0 评论 -
react-dom.development.js:86 Warning: Cannot update a component (`observerComponent`) while rendering
报错前代码改正后的代码原创 2022-06-02 16:58:06 · 2119 阅读 · 0 评论 -
warning.js:6 Warning: [antd: Form.Item] `defaultValue` will not work on controlled Field. You should
用antd Form.Item组件初始化值在使用initialValue上initialValue,而不是在包裹的组件上使用defaultValue设置默认值报错前修改后原创 2022-06-02 17:03:59 · 2220 阅读 · 0 评论 -
react-dom.development.js:86 Warning: Function components cannot be given refs. Attempts to access t
函数组件传递ref报错原创 2022-06-10 09:46:36 · 862 阅读 · 1 评论 -
creact-react-app打包后文件路径有问题
creact-react-app打包文件路径有问题原创 2022-07-12 11:26:32 · 468 阅读 · 0 评论 -
useRoutes与React.lazy的使用
注意react-router-dom的版本6.3.0 和reac版本18.0.0routeConfig.jsApp.js参考https://reactrouter.com/docs/en/v6/hooks/use-routeshttps://stackoverflow.com/questions/65880299/lazy-loading-with-react-router-v6-beta原创 2022-07-12 17:30:57 · 749 阅读 · 0 评论 -
React实现点击左边菜单右边展示组件
React实现点击左边菜单右边展示组件原创 2022-07-12 17:44:50 · 1673 阅读 · 0 评论 -
react hooks定义的函数拿不到最新state的值
react hooks拿不到最新的值原创 2022-07-25 10:39:16 · 1615 阅读 · 0 评论 -
react项目不能解析图片
react项目不能解析图片原创 2022-08-20 18:33:32 · 253 阅读 · 0 评论