How to Repeat a Component N Times in React.js 🧠 #reactjs #reactdevelopment #reactjstutorial #webdev

preview_player
Показать описание
How to use an empty array to repeat the same component multiple times in a layout in React.

📣 Follow Coding in Flow on social media:
Рекомендации по теме
Комментарии
Автор

In 10x approach if you want to pass props it is complex for beginners and intermediate devs

Firestarter
Автор

Just started watching your guide of making a 2d game in unity and its so cool. After that tutorial, what would you suggest to learn about Unity because I really like the 2D game aspect

Chickenuggetz
Автор

Yeah. This approach does same too
[...new Array(12)].map((_, i) => <Box key={i} />)

NijatNiyazov
Автор

I’m sorry if this question is a bit vague (I’m not a React developer), but doesn’t React have for or while loops?

deepindersingh
Автор

Lol. Devs who actually repeat the components are going to feel roasted 😅

BeeBeeEight
Автор

Second implemention wastes memory by allocating an array of undefined elements, the map function then creates a new array of Box elements. Baffling that this is considered "best practices"

immathiasyde
welcome to shbcf.ru