I want to create an array of Buttons which will be rendered by React. The Button is a standard HTML element.
let buttons: HTMLButtonElement[] = []
for(let [key, value] of SomeMap) {
buttons.push(<button onClick={...}>{value}</button>)
}
But this gives me
Argument of type 'Element' is not assignable to parameter of type 'HTMLButtonElement'. Type 'ReactElement<any, any>' is missing the following properties from type 'HTMLButtonElement': disabled, form, formAction, formEnctype, and 300 more.
and
Type 'HTMLButtonElement[]' is not assignable to type 'ReactNode'. Type 'HTMLButtonElement[]' is not assignable to type 'ReactFragment'. The types returned by 'Symbol.iterator.next(...)' are incompatible between these types. Type 'IteratorResult<HTMLButtonElement, any>' is not assignable to type 'IteratorResult<ReactNode, any>'. Type 'IteratorYieldResult' is not assignable to type 'IteratorResult<ReactNode, any>'. Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. Type 'HTMLButtonElement' is not assignable to type 'ReactNode'. Type 'HTMLButtonElement' is missing the following properties from type 'ReactPortal': key, props How woould I create an empty array that can hold buttons in React and TypeScript?