bindCache:用绑定函数的上下文和参数来优化其结果

时间:2021-05-01 04:39:41
【文件属性】:
文件名称:bindCache:用绑定函数的上下文和参数来优化其结果
文件大小:36KB
文件格式:ZIP
更新时间:2021-05-01 04:39:41
JavaScript BindCache 它使用上下文和args缓存/存储绑定函数的结果。 对于相同的集合,每次都会返回相同的结果。 此版本使用来自peerDependencies的es6-map和es6-weak-map填充。 如果不需要它们,或者对Map和WeakMap使用其他填充,则应使用代替它。 动机 它解决了在render方法中使用Function.prototype.bind函数造成不必要的渲染问题。 它还与用于检测此类问题的jsx-no-bind规则保持jsx-no-bind 。 class MyComponent extends Component { onChange ( ) { // ... } render ( ) { const { param } = this . props return (
【文件预览】:
bindCache-master
----.gitignore(75B)
----bindcache.d.ts(149B)
----package.json(1KB)
----package-lock.json(149KB)
----index.js(81B)
----README.md(4KB)
----.prettierrc(72B)

网友评论