score:1
just had to reset the doc :
befor :
const emptycart = async () => {
await userdoc.delete()
await updatecart()
await updatestore()
}
after :
const emptycart = async () => {
const userdoc = await firebase.firestore().collection("cart").doc(usermail)
await userdoc.delete()
await userdoc.set({
item: firebase.firestore.fieldvalue.arrayunion()
})
await updatecart()
await updatestore()
}
Source: stackoverflow.com
Related Query
- Firebase listener with React Hooks
- React Hooks - 0 vs. empty array as second argument in useEffect
- React Hooks won't work on Firebase Cloud Functions Error: Invariant Violation: Invalid hook call
- Firebase - firestore createdAt timestamps - react
- Firebase and React Hooks (useState & useEffect)
- as in React Hooks to give the initial value an empty object
- React Hooks - useState initializes empty array that becomes object?
- delete document after deleting another document firebase firestore - react - web
- Rendering React components mapped from Firebase Firestore
- React Hooks useState Array empty with states rendered in the component
- Trouble Deleting in React Native Firebase Firestore
- React Hooks Firebase - useEffect hook not returning any data
- React Hooks in combination with Firebase data not showing on page load
- Firebase get data from Firestore v9 react
- How do I convert this code from Firebase Firestore v8 to Firebase Firestore v9 Modular in React
- REACT + FIRESTORE : Listen to changes in firebase collection in a react component to automatically update the react state
- Refactor React code, to use Redux state from a Firebase RT database & Redux Hooks
- Unable to insert data to array in firebase firestore using react
- React Redux Firebase - isLoaded only false for the first document when using firestore
- Writing to Firebase Firestore React
- Setting and updating form inputs with firebase database and react hooks
- Comment reply system with React Quill and Firebase Firestore
- With Firebase , using react hooks , objects are not valid as a React child , (If you meant) to render a collection of children, use an array instead
- Reading firestore data via react hooks
- React with AntDesign Lists and Firebase Firestore Data
- Basic example of create, read, update, delete with react hooks and firebase
- React + Firebase Empty Array
- How to convert a React class component to a function component with hooks to get firebase data
- React cart empty function
- When I upload a image firebase storage getdownloadUrl() put download url In Firestore Collections but not set it in React JS
More Query from same tag
- Bootstrap dropdown not working with React router
- How can I attach a ref to a component that i am copying using React.cloneElement
- gatsby with multiple versions of graphql - yarn resolutions
- Next.js Example Auth - re-routing based on auth, wrapping around other functions
- How can I change icon in the KeyboardTimePicker (material-ui-pickers)?
- Getting error when try to use React Router v6: Attempted import error: 'Action' is not exported from 'history'
- Does a callback in useMemo receive any arguments?
- React curried arrow function in event handlers
- Tips to debug React production build code on local environment
- Getting the picture from my api to load reactjs
- How to use Promise.all properly fetching data for React app
- How to fix the Semantic-UI-React dropdown for multiple select
- React.js - Passed function "not a function" Error
- withRouter, connect() and react-compose
- state type change after update in React
- Next JS and Vercel - development vs production
- How do I load an image from my project folder inside a JavaScript file?
- How do I unselect outside of react-select?
- ReactJS - Construct html from mapping
- id undefined in onChange event
- Why Twitter Typeahead doesn't work with React js?
- React setState with Filelist using forEach
- How to use Tooltip in react-redux
- What are the benefits of using react-router over kadira:flow-router for meteor
- Pass string value as object to Redux component with PropTypes in React
- How to create a React.js new window popup
- What is making our Action Creator available as props in React?
- Restapi GET call making website extremely slow
- Couldn't pass a function as props to child component with typescript
- How to listen to route changes in react router v5?