-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtra Code.txt
More file actions
42 lines (36 loc) · 1.63 KB
/
Copy pathExtra Code.txt
File metadata and controls
42 lines (36 loc) · 1.63 KB
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
42
for implementing input number instead of just +/-
// const [quantity, setQuantity] = useState(String(cartItems[item._id]));
// useEffect(() => console.log(quantity),[quantity]);
// const handleInputChange = (event) => {
// const newValue = parseInt(event.target.value.trim());
// // console.log(newValue);
// if (isNaN(newValue)){
// setQuantity("");
// cartItems[item._id]=0;
// }
// else if (newValue<=0){
// console.log(String(newValue));z
// setQuantity(String(newValue));
// cartItems[item._id]=0;
// blurEventHandler(newValue)
// }
// else {
// setQuantity(newValue);
// cartItems[item._id]=newValue;
// }
// };
// const blurEventHandler = (value) => {
// if (quantity === "" || value<=0) {
// //Set custom message
// alert("Quantity cannot be zero. Setting it to 1.");
// setQuantity(1);
// cartItems[item._id] = 1;
// }
// }
In Login SIgnup while sending data,
// const formData = new FormData();
// formData.append("name", data.name);
// formData.append("email", data.email);
// formData.append("password", data.password);
// console.log(formData);
// console.log("Form Data:", Array.from(formData.entries())); // Logging formData to check contents