import { useState } from 'react'

const Form = ({ initial = {} }: object) => {
  const [state, setState] = useState(initial)

  const set = (value: object) => {
    setState((state: object) => ({ ...state, ...value }))
  }

  const reset = () => setState({})

  return [state, set, reset]
}

export default Form
