Congratulations on completing the Working with lists tutorial!
map()
directive for a declarative way of taking an iterable and transforming each item into a renderable template. Use it when all necessary state is controlled by Lit.Array
methods. Consider using a separate private method to abstract the related logic out of the render()
method.repeat()
directive when the rendered DOM nodes have state that isn't controlled by Lit, or when updating the DOM nodes is more expensive than moving them. Provide a key function that produces a unique key for each item of the iterable.range()
directive along with map()
to programmatically generate a list. These can be nested to produce a multi-dimensional grid as well.Check out other built-in directives besides map()
, repeat()
, and range()
that are available, or learn how to make your very own custom directive!
To learn more about reactive properties and the reactive update cycle that drives Lit components, try the Reactivity tutorial