Fix form issue

main
Ashelyn Dawn 5 years ago
parent a460eb2ce8
commit 1732c7518b

@ -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) => {

Loading…
Cancel
Save