Changes between Version 1 and Version 2 of Ticket #47692, comment 18
- Timestamp:
- 05/20/2020 04:40:08 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #47692, comment 18
v1 v2 44 44 {{{#!javascript 45 45 let favouriteFoodsSelectOptions = [ 46 { value: "Vegetables", label: [46 { label: "Vegetables", value: [ 47 47 { value: "peas", label: "Green Peas" } 48 48 { value: "carrots", label: "Carrots" }, 49 49 ] 50 50 }, 51 { value: "Meats", label: [51 { label: "Meats", value: [ 52 52 { value: "chicken", label: "Grilled chicken breast" }, 53 53 { value: "turkey", label: "Roasted turkey" }, 54 54 ] 55 55 }, 56 { value: "Fruits", label: [56 { label: "Fruits", value: [ 57 57 { value: "apples", label: "Red apples" }, 58 58 { value: "oranges", label: "Oranges" }, 59 59 ] 60 60 }, 61 { value: "Desserts", label: [61 { label: "Desserts", value: [ 62 62 { value: "chocolate", label: "Chocolate" }, 63 63 { value: "pudding", label: "Tapioca pudding" }, … … 68 68 }}} 69 69 70 But this doesn't work, it generates an error:70 But this doesn't work, I just see the labels in the rendered **select**, no **optgroup**s and no **value**s. 71 71 72 **''Objects are not valid as a React child (found: object with keys {value, label}). If you meant to render a collection of children, use an array instead.''**73 72 74 73 There must be another intermediate file somewhere that translates between react components and {{{\WP_Customize_Manager::render_control_templates()}}}