08 2021 档案
摘要:Renders the first child <Route> or <Redirect> that matches the location. If the URL is /about, then <About>, <User>, and <NoMatch> will all render bec
阅读全文
摘要:mobx-react中Provider和inject通过context将store注入并使得任何层级的子组件可以访问到store 创建store后在根组件通过Provider组件注入 // App.jsx import React from "react"; import { render } fr
阅读全文
摘要:React.lazy() 允许你定义一个动态加载的组件。这有助于缩减 bundle 的体积,并延迟加载在初次渲染时未用到的组件。 渲染 lazy 组件依赖该组件渲染树上层的 <React.Suspense> 组件。 React.Suspense 可以指定加载指示器(loading indicator
阅读全文
Error: Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
摘要:https://www.cnblogs.com/xulei1992/p/15176992.html https://segmentfault.com/a/1190000038956767 tsdx.config.js const postcss = require('rollup-plugin-po
阅读全文
摘要:// tsdx.config.js const images = require('@rollup/plugin-image'); module.exports = { rollup(config, options) { config.plugins = [ images({ include: ['
阅读全文
摘要:npm link是一种把包链接到包文件夹的方式,即:可以在不发布npm模块的情况下,调试该模块,并且修改模块后会实时生效,不需要通过npm install进行安装 模块和项目在同一目录下 $ npm link ../module 模块和项目不在同一目录下 $ # 先去到模块目录,把它 link 到全
阅读全文
摘要:检查package.json或者npm link时是否正确,更改后删掉node_modules重新安装
阅读全文
摘要:此语法需要名为 "__spreadArray" 的导入帮助器 安装最新版tslib即可
阅读全文
摘要:declare module "*.png"
阅读全文
摘要:如前文所示,在对应的index.d.ts/index.d.tsx中添加如下代码: interface Function { _toFixed(params: any): void; } Function.prototype._toFixed = function(params: any) { thi
阅读全文
摘要:类型“typeof BigNumber”的参数不能赋给类型“Value”的参数。 类型“typeof BigNumber”缺少类型“Instance”中的以下属性: c, e, s 原来: bigNumber._toFixed = function (...arg: any) { return ne
阅读全文
摘要:Your rootDir is currently set to "./". Please change your rootDir to "./src".TSDX has deprecated setting tsconfig.compilerOptions.rootDir to "./" as i
阅读全文
摘要:创建对应文件:如index.d.ts或者index.d.tsx。然后声明一下即可。 如果您不关心外部库的类型,并且希望将所有没有类型的库导入为any,则可以将其添加到具有.d.ts扩展名的文件中: declare module '*'; 这样做的好处(和缺点)是,您可以导入任何东西,TS可以编译。
阅读全文
摘要:删除package-lock.json后重新安装即可
阅读全文
摘要:.section::-webkit-scrollbar { width: 16px; } .section::-webkit-scrollbar-track { background-color: #e4e4e4; border-radius: 100px; } .section::-webkit-
阅读全文
摘要:Error: Invalid hook call. Hooks can only be called inside of the body of a function component. 场景:sdk中使用antd,export之后前端工程引入报错 原因:react冲突 解决: "peerDepe
阅读全文
摘要:react 报错:'React' must be in scope when using JSX react/react-in-jsx-scope 解决: import React, {Component} from 'react'; R大写
阅读全文
摘要:ERROR TypeError: fs.readdir is not a function lerna项目packages下,使用create-react-app创建的项目调用使用create-react-library创建的组件方法时报错 解决:未解决,删除create-react-app项目,重
阅读全文
摘要:解决:降低yarn的版本,从1.22降到了1.18 yarn policies set-version 1.18.0
阅读全文
摘要:can't find module react-scripts 原因:分包版本与root安装版本不一致, 解决:在分别下安装指定版本,yarn add react-scripts@3.4.1
阅读全文
摘要:No packages found where lodash can be added 解决:去对应分包,用npm 安装,然后lerna bootstrap
阅读全文
摘要:Failed to load config "react-app" to extend from. 解决: yarn add eslint-config-react-app 或者: yarn add eslint@latest
阅读全文
摘要:An unexpected error occurred: "expected workspace package to exist for \"@babel/core\"". 解决方法: yarn policies set-version 1.18.0
阅读全文
摘要:什么是LRU缓存函数? LRU是Least Recently Used的缩写,即最近最少使用,是一种常用的页面置换算法,选择最近最久未使用的页面予以淘汰。该算法赋予每个页面一个访问字段,用来记录一个页面自上次被访问以来所经历的时间 t,当须淘汰一个页面时,选择现有页面中其 t 值最大的,即最近最少使
阅读全文