Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

274
Vistas
How do you add data to firebase doc using redux thunk getFireBase and getFirestore from react-redux-firebase

Problem

  • I'm having trouble adding data to the firebase database using react-redux-thunk
  • I've checked the documentation and watched multiple youtube videos but keeping running into error after error
  • I want to add data to a firebase doc using the getFirestore and getFirebase middleware from the "redux-firestore" and "react-redux-firebase" library respectively

Code

  • Here is the action function
  • All the code seems to be working but I can't figure out how to add validatonResults to users/uid (see comment in code below)
  • Tried the following code (and a lot of other stuff) but it didn't work firebase.push('users', { data: validatonResults })
import inputValidationAPI from "../../apis/inputValidationAPI"

export const validateTestCase = payload => {
    return (dispatch, getState, { getFirebase, getFirestore }) => {
        const fireStore = getFirestore()
        const firebase = getFirebase()
        const uid = getState().firebase.auth.uid

        inputValidationAPI
            .post("/submitTerm", {
                term: payload
            })
            .then(response => {
                return response.data.data
            })
            .then(validatonResults => {
                /* 
                validationResults = ["string1", "string2", "string3"]
                I want to take validationResults and add them into firebase collection something like:
                
                firebase.push('todos/${uid}', { some: 'data' }) 
                */

                return validatonResults
            })
            .then(validatonResults => {
                dispatch({
                    type: "VALIDATE_TESTCASE_SUCCESS",
                    payload: validatonResults
                })
            })
            .catch(err => console.log(err))
    }
}
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The following syntax solved this:

fireStore.update(
          { collection: "users", doc: uid },
          { dataToSave: someJSONObject },
     }
)
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda