LoginSignup
1
0

More than 1 year has passed since last update.

【React】 僕だけ知らない Tip (React.Children.toArray)

Last updated at Posted at 2021-06-12
//Bad case
{someData.map(item =>(
     <div key={item.id}> hello! </div>
))}
//Good case
{React.Children.toArray(
  someData.map(item =><div> hello! </div>)
)}

React.Children.toArrayを利用する場合、key属性は要らなくなります。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0