From 1732c7518b16a081efbe4c420e5dae8512c06893 Mon Sep 17 00:00:00 2001 From: Ashelyn Dawn Date: Fri, 13 Mar 2020 19:27:53 -0600 Subject: [PATCH] Fix form issue --- components/form/form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/form/form.js b/components/form/form.js index 5f77304..65bfd36 100644 --- a/components/form/form.js +++ b/components/form/form.js @@ -26,7 +26,7 @@ const errorReducer = (errors, action) => { } } -const formReducer = (state, action)=>{ +const formReducer = errorDispatch => (state, action)=>{ let fields = {...state.fields} const prevField = state.fields[action.name] @@ -91,8 +91,8 @@ export const FormController = function FormController({children, url, method = }) // Create reducers - const [state, dispatch] = useReducer(formReducer, initialState) const [errors, errorDispatch] = useReducer(errorReducer, {}) + const [state, dispatch] = useReducer(formReducer(errorDispatch), initialState) // Handle submitting form const handleSubmit = async (ev) => {