Alright, so I'd like to create a selector with different US States, I'll be using this package, which for the input:
var usStates = new UsaStates();
console.log(usStates.states);`
outputs:
{
name: "Alabama",
abbreviation: "AL",
territory: false,
capital: "Montgomery",
contiguous: true
},
{
name: "Alaska",
abbreviation: "AK",
territory: false,
capital: "Juneau",
contiguous: false
},
...(other states omitted for brevity)
{
name: "Wyoming",
abbreviation: "WY",
territory: false,
capital: "Cheyenne",
contiguous: true
}
I already have a selector component, but it takes options as an array prop like so:
<LNSelect
options={[
{ label: "Alabama", value: "AL" },
{ label: "New York", value: "NY" },
]}
></LNSelect>
How can I use the package's functionality to create an Array in the necessary format with label as the name and value as the abbreviation?
Many thanks!