React
目标前端大佬
这个作者很懒,什么都没留下…
展开
-
React在Eletron中child_process使用案例+加载Node的fs.readfile()后html换行
想把从服务器获取的字符串数据变成html请用dangerouslySetInnerHTML,模板如下:render () { const html = "内容a前面部分<br />内容a后面部分" return( <div dangerouslySetInnerHTML={{__html: html}}> //里面不能放东西 </div> ) }官方解释:https://reactjs原创 2020-05-14 16:56:50 · 884 阅读 · 2 评论 -
配置react-hook的eslint-plugin-react-hooks
package.json 添加 "eslintConfig": { "extends": "react-app", "plugins": [ "react-hooks" ], "rules": { "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-dep...原创 2020-05-08 15:13:43 · 3571 阅读 · 0 评论 -
redux-thunk处理异步action操作,并实现UI更新
redux-thunk实现原理//先判断aciton是否为一个方法,如是方法,//则将store.dispatch作为参数传入到自己的action中,//再次调用dispatch,这里应该就是递归思想,自己调自己。const thunk = store => next => action => typeof action === 'function' ? ac...原创 2020-04-29 10:19:42 · 395 阅读 · 0 评论 -
redux简单用法&&自定义middleware+分析
import { createStore, applyMiddleware } from 'redux'//定义一个actionsconst visibleGloble = (visible) => { return { type: 'CHANGE_VISIBLE_STATE', visible: visible || 0, text: '这是初始数据'...原创 2020-04-28 14:57:31 · 197 阅读 · 0 评论 -
React 使用customize reacta-app-rewired配置Antd
简述两者使用为了修改webpack配置,无需eject安装npm i customize reacta-app-rewired -D使用/** 基于customize 和 react-app-rewired的定制化配置文件* */// 引入相关的方法const { override, addLessLoader} = require('customize-c...原创 2020-04-08 14:22:15 · 590 阅读 · 1 评论 -
React高阶组件HOC以及cra简单使用
//Hoc.jsimport React, {Component} from "react";const withCopyRight = (MyComponent) => { return class withCopyRight extends Component { render() { console.log(this.props)//指向子组件的pr...原创 2020-04-08 14:32:05 · 477 阅读 · 0 评论