We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一个 Component 同时配置 className 与 style 字段时,会编译成如下:
<Component style={Object.assign({}, _styleSheet[className], style)} />
来自: https://github.com/raxjs/rax-scripts/blob/c4565b0ef73d5a76aa77910952cb4e3f864aa487/packages/babel-plugin-transform-jsx-stylesheet/src/tests/index.js#L254-L269
这样会直接导致通过 memo 和 PureComponent 进行优化的 Component 优化无效。
react-perf/jsx-no-new-object-as-prop
是否可能将 className 与 style 的合并结果进行缓存,从而不影响 memo 和 PureComponent 的组件优化呢?
The text was updated successfully, but these errors were encountered:
内联方案的取舍问题,在将 className 转换到内联的时候,本质从浏览器渲染的角度来说会提升性能,但是会造成你所提到的 PureComponent or memo 失效的问题,由于涉及到 ast 解析以及侵犯过多的业务代码,框架本身难以去内置这部分优化,而且从 memo 处理的角度,可以从业务代码层面加入一些处理来避免复杂组件的 rerender
Sorry, something went wrong.
No branches or pull requests
一个 Component 同时配置 className 与 style 字段时,会编译成如下:
这样会直接导致通过 memo 和 PureComponent 进行优化的 Component 优化无效。
是否可能将 className 与 style 的合并结果进行缓存,从而不影响 memo 和 PureComponent 的组件优化呢?
The text was updated successfully, but these errors were encountered: