Closed motro closed 8 years ago
Something along the lines of
const hobbies = ['surf', 'tennis']
const hobbiesProps = {}
hobbies.forEach(h => hobbiesProps[h] = t.Boolean)
const Type = t.struct({
firstName: t.String,
lastName: t.String,
hobbies: t.struct(hobbiesProps)
})
Thanks for the super-fast response! I'll try this one and let you know.
I'd like to create a form that holds both a Person's fields (first name, last name, etc') and a checkboxes list of the selected hobbies, just like Rails' collection_check_boxes (http://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/collection_check_boxes)
The hobbies come from a different data source so their number may vary.
How would you recommend implementing that?
Thanks!