现在,这段代码显示了一个列出“选项#”的下拉表单。如何使所有 50 个州都可选择而不是选项和数字?
import React, { useState } from 'react';
import {
Box,
FormField,
Grommet,
Select,
MaskedInput,
TextInput
} from 'grommet';
import { grommet } from 'grommet/themes';
const allOptions = Array(50)
.fill()
.map((_, i) => `option ${i + 1}`);
export const Simple = () => {
const [value, setValue] = useState('');
return (
<Grommet theme={grommet}>
<Box align="center" background="light-2" >
<FormField label="State" htmlFor="select" >
<Select
id="select"
placeholder="placeholder"
options={allOptions}
value={value}
onChange={({ option }) => setValue(option)}
/>
</FormField>
</Box>
</Grommet>
);
};
export default {
title: 'Input/FormField/Simple',
};