From f2947397f4e99911fe0f8b38c1b1a0c2661dd3e2 Mon Sep 17 00:00:00 2001
From: Blaster4385 <venkateshchaturvedi12@gmail.com>
Date: Thu, 18 Aug 2022 20:28:10 +0530
Subject: Switch to context api for enrollment form

---
 client/src/pages/Enrollment/FormTwo/FormTwo.jsx | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

(limited to 'client/src/pages/Enrollment/FormTwo/FormTwo.jsx')

diff --git a/client/src/pages/Enrollment/FormTwo/FormTwo.jsx b/client/src/pages/Enrollment/FormTwo/FormTwo.jsx
index 205b3d9..05ad075 100644
--- a/client/src/pages/Enrollment/FormTwo/FormTwo.jsx
+++ b/client/src/pages/Enrollment/FormTwo/FormTwo.jsx
@@ -3,20 +3,22 @@ import Input from '../../../components/Input/Input'
 import Header from '../../../components/Header/Header'
 import SubmitButton from '../../../components/SubmitButton/SubmitButton'
 import { useTranslation } from 'react-i18next'
+import { userContext } from '../../../context/User'
 
-const FormTwo = ({ formData, setFormData }) => {
+const FormTwo = () => {
   const { t } = useTranslation()
+  const { userData, setUserData } = userContext()
   return (
     <div className="formtwo">
       <Header subheading={t('ENROLLMENT')} />
       <Input
         id="mobile"
-        value={formData.mobile}
+        value={userData.mobile}
         label={t('MOBILE')}
         type="text"
         onChange={(e) => {
-          setFormData({
-            ...formData,
+          setUserData({
+            ...userData,
             mobile: e.target.value
           })
         }}
@@ -24,12 +26,12 @@ const FormTwo = ({ formData, setFormData }) => {
       />
       <Input
         id="email"
-        value={formData.email}
+        value={userData.email}
         label={t('EMAIL')}
         type="email"
         onChange={(e) => {
-          setFormData({
-            ...formData,
+          setUserData({
+            ...userData,
             email: e.target.value
           })
         }}
-- 
cgit 

