filmov
tv
React 18: Checkbox List Loaded Dynamically from a JSON file (with some pre-selected choices)

Показать описание
In this video we look at React code that reads a JSON file containing a property that is an array of objects. From that array of objects, the React code constructs a set of checkboxes that allow the user to choose any number of choices. Two of the options were pre-selected just to make it a little more challenging. We tried to minimize the React warnings and errors in the console, so we gave each repeated element generated by React a unique key. We also worked with the defaultChecked property instead of the checked property to allow the user to de-select a choice without generating an error.