Repository: final-form/react-final-form (js)

Issue:
6.3.1 breaks autosave example
### Are you submitting a **bug report** or a **feature request**?
Bug report

### What is the current behavior?

Upon updating to 6.3.1, the AutoSave example no longer works. "values" is always undefined and thus AutoSave never submits form changes.

### What is the expected behavior?

That the AutoSave example would work, or be updated to work.

### Sandbox Link

https://codesandbox.io/s/react-final-form-auto-save-with-debounce-flqx3

### What's your environment?

React-Final-Form: 6.3.1
Final-Form: 4.18.6
React: 16.12.0


Pull request description:
Made lazy state getters enumerable
Fixes #677 

Also fixes bug found by @onlyann here: https://github.com/final-form/react-final-form/issues/677#issuecomment-555375751

Patch:
diff --git a/src/getters.js b/src/getters.js
index 949953e..e59bb3f 100644
--- a/src/getters.js
+++ b/src/getters.js
@@ -3,7 +3,8 @@ import type { FormState, FieldState } from 'final-form'
 const addLazyState = (dest: Object, state: Object, keys: string[]): void => {
   keys.forEach(key => {
     Object.defineProperty(dest, key, {
-      get: () => state[key]
+      get: () => state[key],
+      enumerable: true
     })
   })
 }
diff --git a/src/renderComponent.js b/src/renderComponent.js
index eaeedcd..b2a5776 100644
--- a/src/renderComponent.js
+++ b/src/renderComponent.js
@@ -11,12 +11,13 @@ export default function renderComponent<T>(
 ): React.Node {
   const { render, children, component, ...rest } = props
   if (component) {
-    return React.createElement(component, {
-      ...rest,
-      ...lazyProps,
-      children,
-      render
-    })
+    return React.createElement(
+      component,
+      Object.assign(lazyProps, rest, {
+        children,
+        render
+      })
+    )
   }
   if (render) {
     return render(


Test patch:
diff --git a/src/useFormState.test.js b/src/useFormState.test.js
index 5537585..2a3fa88 100644
--- a/src/useFormState.test.js
+++ b/src/useFormState.test.js
@@ -3,7 +3,7 @@
 import React from 'react'
 import { render, cleanup } from '@testing-library/react'
 import { ErrorBoundary } from './testUtils'
-import { useFormState } from './index'
+import { useFormState, Form } from './index'
 
 describe('useField', () => {
   afterEach(cleanup)
@@ -30,4 +30,21 @@ describe('useField', () => {
     )
     console.error.mockRestore()
   })
+
+  it('state should be enumerable', () => {
+    const Test = () => {
+      const state = useFormState()
+      expect(Object.keys(state).length > 0).toBe(true)
+      return <div>It worked</div>
+    }
+    render(
+      <Form onSubmit={() => {}}>
+        {({ handleSubmit }) => (
+          <form onSubmit={handleSubmit}>
+            <Test />
+          </form>
+        )}
+      </Form>
+    )
+  })
 })