mirror of
https://github.com/a-h/templ.git
synced 2025-02-06 09:27:56 +00:00
3c65b4309b
Co-authored-by: Adrian Hesketh <adrianhesketh@hushmail.com>
20 lines
478 B
Go
20 lines
478 B
Go
package templ
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
)
|
|
|
|
// Join returns a single `templ.Component` that will render provided components in order.
|
|
// If any of the components return an error the Join component will immediately return with the error.
|
|
func Join(components ...Component) Component {
|
|
return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
|
|
for _, c := range components {
|
|
if err = c.Render(ctx, w); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
})
|
|
}
|