Skip to content

Instantly share code, notes, and snippets.

View rishipurwar1's full-sized avatar
🎯
Focusing

Rishi Purwar rishipurwar1

🎯
Focusing
View GitHub Profile
@rishipurwar1
rishipurwar1 / useForm.js
Created December 22, 2022 12:06
useForm custom hook
import { useEffect, useState } from "react"
export const useForm = (options) => {
const [data, setData] = useState(options?.initialValues || {})
const [errors, setErrors] = useState({})
const handleInputChange = (event) => {
const { name, value } = event.target
setData({
...data,
import { useEffect, useReducer, useState } from "react"
import {
addDoc,
collection,
deleteDoc,
doc,
serverTimestamp,
updateDoc,
} from "firebase/firestore"
{
"name": "codingspace",
"version": "0.1.0",
"private": true,
"dependencies": {
"@glidejs/glide": "^3.4.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"@typeform/embed-react": "^1.1.1",