DEV Community

Passionate Coder
Passionate Coder

Posted on

3 1

List Rendering in React

Why we need List Rendering in React

Whenever we need to render same type of components or elements multiple time (with different data) than we use List rendering to automate rendering

How to do List Rendering in React

Javascript map() operator (Introduced in ES6) is used for List Rendering.

Benefits

  1. Reduces Line of code
  2. Automates Rendering

STATIC WAY : NOT EFFICIENT

image

USING MAP

image

You can follow me on my youtube videos channel.

Videos in Hindi

Top comments (2)

Collapse
 
fjones profile image
FJones • Edited

I notice that you aren't setting a key prop on the mapped version. React should still throw a warning on that - with good reason, as it does consider it in performance optimizations.

For reference: reactjs.org/docs/lists-and-keys.ht...

Collapse
 
passionate_coder profile image
Passionate Coder

Yes I will update this post for more such details.

Thanks for reading

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay