react
react copied to clipboard
Bug: d1 will cause domdiff, but d2 will not.
React version:
Steps To Reproduce
const dataList = [...Array(50000)].map(() => 1)
const d1 = <>{dataList}</>
const d2 = <div>{dataList}</div>
function Apps() {
const [count, setCount] = useState(0)
return (
<div>
<button onClick={() => setCount(count + 1)}>increase{count}</button>
<div>{d1}</div>
<div>{d2}</div>
</div>
)
}
click button trigger rerender,
thend1
will cause domdiff, but d2
will not
I wonder if this is a bug, tks
Link to code example:
The current behavior
The expected behavior
Hey @zhangenming. I am trying to understand this issue but I don't understand it. Could you please elaborate more about it?
https://codesandbox.io/s/wandering-breeze-jx8g89?file=/src/index.js
use devtool perfermance analyse it, you will find this code,d1
will cause domdiff, when click button;
but d2 https://codesandbox.io/s/affectionate-zhukovsky-rutjbj different