-
Notifications
You must be signed in to change notification settings - Fork 560
[Feature Request] Can we do some Static Analysis for diff with babel ? #181
New issue
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
Comments
It's different. what I say is accelerate react diff. function Hello(props) {
<div className="xx" style={{height: 8}}>
{props.children}
</div>
} As I know, in this example, when update the component, react in order to do the diff algorithm, will compare the but the And react can't judge "Are so I think can Babel tell react, what need to compare. |
an extra operation to check what shall be compared might take more time than the actual compare. |
I can't understand why it is an extra operation. // (exclude Spread Operator like `<div {...props}></div>`)
Object.keys(props).forEach(key => {
// compare
})
// `dynamicProps` is an string array that babel generate
dynamicProps.forEach(keys => {
// compare
}) I think Actually, many components are constant, they event don't need to compare. |
No, React will just use But back to your concerned topic, from my personal perspective, the static/runtime compiler optimization will not be the key goal of React. It has tried |
ok, I understand . Thanks. |
react don't konw which prop is static,but can we get the help with babel ?
like this.
then, react will know, the props need to diff are only
onClick
andchildren
.Is it feasible?
The text was updated successfully, but these errors were encountered: