diff --git a/.DS_Store b/.DS_Store
index 2b8748c..e7ca11b 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/README.md b/README.md
index 1b90223..b8f8a9a 100755
--- a/README.md
+++ b/README.md
@@ -4,6 +4,9 @@ A fork of the code from this tutorial for building this project can be found ove
Changes:
- replaced Bulma with [rbx](https://dfee.github.io/rbx) components
- incorporated suggestions from comments section on simplifying usage and avoiding a uncontrolled to controlled error
- - added support for checkboxes, with example
+ - added optional second argument for initializating fields
+ - added support for checkboxes
+ - added select example with initialization
+ - added checkbox example
![A login form built in React and rbx, using custom React Hooks to power the form](./screenshot.png?raw=true)
diff --git a/screenshot.png b/screenshot.png
index 69dc06a..1355695 100644
Binary files a/screenshot.png and b/screenshot.png differ
diff --git a/src/Form.js b/src/Form.js
index 57f89f3..ce44b46 100644
--- a/src/Form.js
+++ b/src/Form.js
@@ -1,10 +1,13 @@
import React from 'react';
import "rbx/index.css";
-import { Button, Checkbox, Column, Container, Control, Field, Input, Label, Section } from 'rbx';
+import { Button, Checkbox, Column, Container, Control, Field, Input, Label, Section, Select } from 'rbx';
import useForm from "./useForm";
const Form = () => {
- const [ values, handleChange,] = useForm(['email', 'password', 'human']);
+ const [values, handleChange] = useForm(
+ ['email', 'password', 'human', 'homeworld'],
+ { homeworld: 'Earth' },
+ );
function login(event) {
event.preventDefault();
@@ -30,14 +33,30 @@ const Form = () => {
-
+
+
+
+
+
+
+
+
diff --git a/src/useForm.js b/src/useForm.js
index 260526a..0b049e1 100644
--- a/src/useForm.js
+++ b/src/useForm.js
@@ -1,9 +1,9 @@
import { useState } from 'react';
-const useForm = (names) => {
+const useForm = (names, inits) => {
const [values, setValues]
- = useState(names.reduce((obj, name) => ({...obj, [name]: ''}), {}));
+ = useState(names.reduce((obj, name) => ({...obj, [name]: (inits || {})[name] || ''}), {}));
const handleChange = (event) => {
const { name, value, type, checked } = event.target;