← Back to JavaScript
27

Dynamic rendering: build lists and cards from data

Learn how to turn arrays into real interface output through render templates, empty/loading/error states and DOM update patterns that stay maintainable.

📘 Theory

Render mindset: the UI is a projection of state

Do not mutate random nodes without a data source you can explain.

When state changes because of a filter, search or deletion, the screen should reflect that state deterministically.

Separating transformation, template and mounting keeps the rendering flow understandable even when business rules grow.

1

State

2

Transform

3

Render

4

Result

A practical base pattern with `map()` and `join('')`

For simple lists, this is fast and readable.

1

Create a function that receives data and returns an HTML string through `map().join('')`.

2

Then assign the final result once. Avoid repeating `innerHTML +=` inside loops.

Render real UI states: loading, empty and error

A robust list does not only handle success.

1

Before you paint results, define what the user sees when data is still loading, when there are no results and when something fails.

2

Those states should be part of the render contract, not last-minute patches.

🧪 Learn by doing

Example Interactive demo: a dynamic catalog Filter and render product cards in real time from an in-memory array.

🏁 Challenges

Challenge Challenge: render a list with a template function Create a template function and use `map().join('')` to paint a list of tasks.

What is this?

I'm Cristian Eslava and I sometimes build websites so both you and I can learn and experiment. culTest

I made this in February 2026 to make learning easier for my students. The idea is to learn web development by practicing and to keep expanding the project with new topics, tests and challenges.

It draws inspiration from MDN, W3Schools, CodePen, Manz and many other web development references. I wanted to combine useful theory, runnable examples, challenges and the testing system I had already built for culTest. culTest

If you liked it, if you didn't, or if you want to get in touch, write to me at cristianeslava@gmail.com