-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDateContext.js
41 lines (37 loc) · 1.06 KB
/
DateContext.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, { useEffect, useState, useContext } from "react";
const DateContext = React.createContext();
const DateProvider = ({ children }) => {
const [dateSelectionStatus, setDateSelectionStatus] = useState(false);
const [clientInfoDone, setClientInfoDone] = useState(false);
const [selectedDate, setSelectedDate] = useState("");
const [selectedTime, setSelectedTime] = useState("");
const [emailId, setEmailId] = useState("");
const [phoneNo, setPhoneNo] = useState("");
const [name, setName] = useState("");
return (
<DateContext.Provider
value={{
selectedDate,
setSelectedDate,
selectedTime,
setSelectedTime,
dateSelectionStatus,
setDateSelectionStatus,
clientInfoDone,
setClientInfoDone,
emailId,
setEmailId,
phoneNo,
setPhoneNo,
name,
setName,
}}
>
{children}
</DateContext.Provider>
);
};
export const useGlobalDateContext = () => {
return useContext(DateContext);
};
export { DateContext, DateProvider };