fix: delete Object.fromEntries ponyfill cause of bugs

This commit is contained in:
divlo
2020-10-26 02:35:56 +01:00
parent 1601626fd9
commit 4058b48959
4 changed files with 3 additions and 13 deletions

View File

@ -1,9 +0,0 @@
/*! fromentries. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
export function fromEntries<T = any>(
iterable: Iterable<readonly [PropertyKey, T]>
) {
return [...iterable].reduce((object, [key, value]) => {
object[key] = value
return object
}, {})
}

View File

@ -1,5 +1,4 @@
import React, { useRef } from 'react'
import { fromEntries } from './fromEntries'
export interface FormDataObject {
[key: string]: FormDataEntryValue
@ -19,7 +18,7 @@ interface FormProps extends ReactFormProps {
}
const getFormDataObject = (formElement: HTMLFormElement): FormDataObject => {
return fromEntries<FormDataEntryValue>(new FormData(formElement))
return Object.fromEntries<FormDataEntryValue>(new FormData(formElement))
}
const Form = (props: FormProps): JSX.Element => {