Skip to content

How to render a seed for each element in a collection? #20

Answered by Splizard
SteveMaybe asked this question in Q&A
Discussion options

You must be logged in to vote

This is actually quite a challenging use-case, as until we get generics later this year, there are no type-safe clientside collections.

The best thing you can do at the moment is to use 'feeds' (qlova.org/seed/new/feed). Feeds are like repeaters but for dynamic collections.

package main

import (
	"image/color"

	"qlova.org/seed/client"
	"qlova.org/seed/new/app"
	"qlova.org/seed/new/button"
	"qlova.org/seed/new/feed"
	"qlova.org/seed/new/text"
	"qlova.org/seed/set/align"
	"qlova.org/seed/use/js"
	"qlova.org/seed/use/js/console"
)

func main() {
	//Create a new feed of 'values'
	var values = feed.With(func() []string {
		//return type can be any json-serialisable slice.
		return []string{"a"

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Splizard
Comment options

Answer selected by Splizard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants