Gray Zhang
Gray Zhang
See https://github.com/microsoft/TypeScript/issues/46770#issuecomment-966612103 for detail
Without any options specified, with `[email protected]`, `[email protected]` and `[email protected]` ```css :root { --font-family: 'Courier New', Courier, monospace; } div { font-family: var(--font-family); } ``` becomes: ```css :root { --font-family: 'Courier...
This is an interesting hook to cast a custom equal object to reference equal, suppose we have a simple fetch component: ```js const View = ({params}) => { const [value,...
看到 https://github.com/react-component/select/blob/master/src/Select.tsx#L112-L113 的参数类型在近期修改成了`RawValueType | LabelInValueType`,我们使用过程中有遇到`tsc`检查出来的类型不兼容问题 从文档来看,似乎`onSelect`和`onDeselect`的参数只能是value而不会是option对象:  想了解一下,如果这个类型的更新是正确的,那么什么情况下`value`参数的值会是`LabelInValueType`类型,便于用户做好相应的逻辑处理
现在的代码是这样的: ```js if (skr.features.foo) { // 代码 } console.log(skr.build.target); ``` 模块化以后,期望是这样: ```js import {foo} from '@skr/features'; import {target} from '@skr/build'; if (foo) { // 代码 } console.log(target); ``` 这个在SWC中可以用[constModules](https://swc.rs/docs/configuration/compilation#jsctransformconstmodules)搞定,但其它编译方案不知道有没有替代的
现在`reSKRipt`默认是不带图片压缩功能的,装上`@reskript/config-img-loader`以后会使用`img-loader`去做图片压缩。这东西依赖`imagemin`需要网络下载二进制,影响安装的速度和成功率 现在有[squoosh](https://www.npmjs.com/package/@squoosh/lib)用WASM来实现图片压缩,可以写一个loader出来
Pick `useArray` as an example, this hook creates a bunch of convenient functions around `Array` types, it manages a local state by using `useState` in its implementation: ```tsx const [list,...
在某些时候,我们已经有了一个数组,但要对这个数组做额外的修改(对应`derivedState`),但当这个原始数组变化时,我们的额外修改还要保持住。 场景一: > 有一个列表,并且可以新增条目,新增的条目会临时放在列表的最上方向。无论列表是否切换页码、排序,新增条目要保持。 场景二: > 在无限滚动加载的列表中,删除了某些项,此时再滚动增加新内容后,要依然保持删除的项不会出现。 这种情况下,`useDerivedState`是没法用的,因为原始数组变化(翻页、新加载内容)后,就会变成新的数组,原来的新增、删除等操作都没了 所以我们需要一个`useComputedArray`,基于一个原始数组,并在内部以“操作”的形式记录对它的修改,无论原始数组怎么变,都可以把“操作”覆盖上去保留