react icon indicating copy to clipboard operation
react copied to clipboard

Bug: d1 will cause domdiff, but d2 will not.

Open zhangenming opened this issue 1 year ago • 2 comments

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

zhangenming avatar Jul 15 '22 15:07 zhangenming

Hey @zhangenming. I am trying to understand this issue but I don't understand it. Could you please elaborate more about it?

7777chaitanya avatar Jul 15 '22 16:07 7777chaitanya

https://codesandbox.io/s/wandering-breeze-jx8g89?file=/src/index.js 1657932240(1)

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

zhangenming avatar Jul 16 '22 00:07 zhangenming