diff --git a/package.json b/package.json
index 0d8825f..3b85f64 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,7 @@
},
"dependencies": {
"@apollo/react-hooks": "^3.1.3",
+ "@open-wc/lit-helpers": "^0.3.1",
"@webcomponents/webcomponentsjs": "^2.4.2",
"apollo-boost": "^0.4.7",
"apollo-server-express": "^2.10.1",
diff --git a/src/web/bookform.ts b/src/web/bookform.ts
index d731e84..62626e6 100644
--- a/src/web/bookform.ts
+++ b/src/web/bookform.ts
@@ -1,6 +1,9 @@
import { component, html, useState } from 'haunted';
+import { spread } from '@open-wc/lit-helpers';
import { useMutation } from '@apollo/react-hooks';
import * as yup from 'yup';
+
+import { useFormField } from './myhooks';
import { AddBook, GetBooks } from './queries'
import Css from './bookform.scss';
@@ -10,27 +13,26 @@ const schema = yup.object().shape({
});
const BookForm = () => {
- const [title, setTitle] = useState("");
- const [author, setAuthor] = useState("");
+ const [titleProps, setTitle] = useFormField("author");
+ const [authorProps, setAuthor] = useFormField("author");
const [addBook, { loading }] = useMutation(AddBook);
return html`
- setTitle(e.target.value)}>
- setAuthor(e.target.value)}>
+
+