Switching from a map to a flatMap makes it possible to provide an array of elements instead of a single element for the return of the switch statement. This is useful if you want to add an empty text element before/after an image element, or replace a simple node with a more complex tree.
Switching from a map to a flatMap makes it possible to provide an array of elements instead of a single element for the return of the switch statement. This is useful if you want to add an empty text element before/after an image element, or replace a simple node with a more complex tree.