react login api example

  const [isBookingDone, setIsBookingDone] = useState(false); const [isError, setIsError] = useState(false); const [errorMessage, setErrorMessage] = useState(”); const slotBooking = async (slotTiming, bookedDate, userId) => { let config = { url: `http://localhost:3005/api/bookings`, method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’, }, data: { ‘slotTiming’: slotTiming, ‘bookedDate’: bookedDate, ‘userId’: userId }, }; await axios(config).then((res) => { loadBookingData(); setIsBookingDone(true); }).catch((e) …

react login api example Read More »

call useEffect Axios api in react

  useEffect(() => { const loadPost = async () => { // Till the data is fetch using API // the Loading page will show. setIsLoading(true); // Await make wait until that // promise settles and return its result const response = await axios.get( `${bookingDate}`); // After fetching data stored it in posts state. setBookingData(; …

call useEffect Axios api in react Read More »

update object value in an array in javascript

  const storage= [ { id:1, name:“kahnu”, email:“[email protected]”, age:21, phone:1234567890 }, { id:2, name:“kahnu2”, email:“[email protected]”, age:22, phone:1234567890 }, { id:3, name:“kahnu3”, email:“[email protected]”, age:23, phone:1234567890 } ] const objIndex = storageData.findIndex((obj => == ‘1’)); storageData[objIndex].name = ‘new name’; storageData[objIndex].email = ‘new email’; storageData[objIndex].age = ‘new age’; console.log(“After update: “, storageData[objIndex])

Deploy React App on Shared Hosting(Cpanel)

In order to deploy the React app on Shared hosting we need to replace this local address with your domain name. Replacing localhost with domain name. Adding Domain in package.json In package.json file of your react app add a new property “homepage”:”” In order to deploy react App on Shared hosting we need to build the app. 2.Building the app using npm run …

Deploy React App on Shared Hosting(Cpanel) Read More »