Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
_firebase_js__WEBPACK_IMPORTED_MODULE_9__.db.collection is not a function

I learned firebase 8 and now the firebase 9 update is confusing me. i am trying to connect to cloud firestore but it always give me this error firebase_js__WEBPACK_IMPORTED_MODULE_9_.db.collection is not a function. already read the documentation but still cant figure out what is wrong.

    import React ,{useEffect, useState} from 'react';
import CheckoutProduct from './CheckoutProduct';
import "./Payment.css";
import {useStateValue} from "./StateProvider";
import {Link, useNavigate} from "react-router-dom";
import {CardElement, useStripe, useElements} from "@stripe/react-stripe-js";
import CurrencyFormat from 'react-currency-format';
import {getBasketTotal} from "./reducer";
import axios from "./axios";
import { collection, addDoc } from "firebase/firestore"; 
import {db} from "./firebase.js";



 const handleSubmit = async (event) => {
        // do all the fancy stripe stuff...
        event.preventDefault();
        setProcessing(true);

        const payload = await stripe.confirmCardPayment(clientSecret, {
            payment_method: {
                card: elements.getElement(CardElement)
            }
        }).then(({ paymentIntent }) => {
            // paymentIntent = payment confirmation

            setSucceeded(true);
            setError(null)
            setProcessing(false)



            db
              .collection('users')
              .doc(user?.uid)
              .collection('orders')
              .doc(paymentIntent.id)
              .set({
                  basket: basket,
                  amount: paymentIntent.amount,
                  created: paymentIntent.created
              })

            dispatch({
                type:'EMPTY_BASKET'
            })
            navigate('/orders', {replace :true})
        })

    }

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda