mirror of
https://github.com/theoludwig/react-component-form.git
synced 2024-07-17 07:30:13 +02:00
fix: delete Object.fromEntries ponyfill cause of bugs
This commit is contained in:
parent
1601626fd9
commit
4058b48959
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-component-form",
|
"name": "react-component-form",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-component-form",
|
"name": "react-component-form",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"description": "Manage React Forms with ease.",
|
"description": "Manage React Forms with ease.",
|
||||||
"author": "Divlo <contact@divlo.fr>",
|
"author": "Divlo <contact@divlo.fr>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -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
|
|
||||||
}, {})
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
import React, { useRef } from 'react'
|
import React, { useRef } from 'react'
|
||||||
import { fromEntries } from './fromEntries'
|
|
||||||
|
|
||||||
export interface FormDataObject {
|
export interface FormDataObject {
|
||||||
[key: string]: FormDataEntryValue
|
[key: string]: FormDataEntryValue
|
||||||
@ -19,7 +18,7 @@ interface FormProps extends ReactFormProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getFormDataObject = (formElement: HTMLFormElement): FormDataObject => {
|
const getFormDataObject = (formElement: HTMLFormElement): FormDataObject => {
|
||||||
return fromEntries<FormDataEntryValue>(new FormData(formElement))
|
return Object.fromEntries<FormDataEntryValue>(new FormData(formElement))
|
||||||
}
|
}
|
||||||
|
|
||||||
const Form = (props: FormProps): JSX.Element => {
|
const Form = (props: FormProps): JSX.Element => {
|
||||||
|
Loading…
Reference in New Issue
Block a user