alibaba / rax

🐰 Rax is a progressive framework for building universal application. https://rax.js.org
Other
7.99k stars 625 forks source link

[BUG]如果两个空变量会报错` Encountered two children with the same key "".` #2209

Closed yiescc closed 1 year ago

yiescc commented 3 years ago

Describe the bug 如果有两个空的变量渲染在一个地方就会报错same key

To Reproduce

{[
        { id: 0, icon: "", prefix1: "", suffix1: "" },
        { id: 1, icon: "", suffix1: "", prefix1: "" }
      ].map((item) => {
        return (
          <div key={item.id}>
            {item.id}
            <i style={{ backgroundImage: `url(${item.icon})` }} />
            <span>
              {item.prefix1}
              {item.suffix1}
            </span>
          </div>
        );
      })}

https://codesandbox.io/s/optimistic-microservice-cyeuo?file=/src/app.js

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

(please complete the following information)

Additional context Add any other context about the problem here.