
react
react
qq_48557089
这个作者很懒,什么都没留下…
展开
-
antd 自定义主题
antd自定义主题原创 2022-06-27 16:00:03 · 801 阅读 · 0 评论 -
react 项目降版本
react最近不是出18了吗但问题是很多的库都还不支持而且工作中不会使用特别新的技术但用create-react-app创建的项目默认为react18版本1. 命令npm install react@17.x react-dom@17.x --save2. 报错:无法解析模块“react-dom在index.js文件中更改为以下内容:import React from 'react';import ReactDOM from 'react-dom';import '.原创 2022-05-07 17:12:46 · 850 阅读 · 1 评论 -
react 中的闭包陷阱
在函数组件中,如果我们在回调函数中使用了 state 的值,那么闭包就会产生。闭包在函数创建时产生,他会缓存创建时的 state 的值。import { useState } from 'react';export default function Counter() { const [count, setCount] = useState(0) function handle() { setCount(count + 1) // 当 setTimeout 执行时,原创 2022-04-18 10:18:48 · 1699 阅读 · 0 评论 -
组件有默认参数的情况下,传递自定义参数
onMenuItemClick函数的第一个参数{}传递默认的参数,第二参数{}传递其他参数function xx({},{id, title}) { this.h=function(key) { console.log(key); } } const content = (node) => { const { key:id, title } = node.dataRef; return ( // 第一个参数{}传递.原创 2022-04-13 15:37:02 · 457 阅读 · 0 评论 -
取出对象的某个值(数组),数组的可迭代特性消失
const memberInfo= { id: '1-1-1-1', name: '张四', position: '运营', department: ['1-1', '1-2-1'], phoneNumber: '18872632514', identity: 1, manageDepartment: ['1-1-1'], mail: '11722222@qq.com', state: '正常', operate: [['编辑.原创 2022-01-21 09:54:56 · 290 阅读 · 0 评论 -
redux 教程 --- 基础概念
一、redux 包含以下部分的自包含应用程序state:驱动应用的真实数据源头 view:基于当前状态的 UI 声明性描述 actions:根据用户输入在应用程序中发生的事件,并触发状态更新二、单向数据流用 state 来描述应用程序在特定时间点的状况 基于 state 来渲染出 View 当发生某些事情时(例如用户单击按钮),state 会根据发生的事情进行更新,生成新的 state 基于新的 state 重新渲染 View三、不可变性 ImmutabilityJavaS原创 2021-12-29 17:36:15 · 568 阅读 · 0 评论 -
react脚手架初始化失败
1. 把yarn的安装包删除2. 命令 npm install3. 命令npx create-react-app my-app原创 2021-11-30 09:19:42 · 432 阅读 · 0 评论 -
react样式模块化
1. 将 .css后缀 文件夹改为 .module.css 后缀的文件夹2. 所有<hello>组件相关的样式都保存在Css中import React, { Component } from "react";import Css from './index.module.css'export default class Hello extends Component { render() { return ( <h1 c.原创 2021-12-03 15:38:50 · 628 阅读 · 0 评论 -
在react脚手架中使用Tailwind CSS (入门)
参考教程 Build a Website with React and Tailwind CSS - SitePoint本文翻译外网,主要自用1. 安装 Tailwind CSS 所需的依赖项npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9我们正在安装具有 PostCSS 7 兼容性版本的 Tailwind CSS,因为在撰写本文时,Create React App.原创 2021-12-09 15:27:13 · 4084 阅读 · 0 评论 -
在 react 中使用 windicss
参考官方文档Webpack 集成 {#integration-for-webpack} | Windi CSSreact 支持craco框架windicss有什么不理解的可以参考Tailwind CSS 中文文档1. 安装 windicss架构yarn add windicss-webpack-plugin -D# npm i windicss-webpack-plugin -D2. 安装craconpm install @craco/craco3. 根目录下创..原创 2021-12-10 11:48:47 · 2117 阅读 · 0 评论 -
react 快速创建组件
参考 ES7 React/Redux/GraphQL/React-Native snippets - Visual Studio Marketplace1. 下载ES7 React/Redux/GraphQL/React-Native snippets2. 再.jsx 或 .js 文件中填入前缀函数式组件的前缀 rfce class组件的前缀 rcc原创 2021-12-22 17:14:09 · 679 阅读 · 0 评论