Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

84
Views
Can't run UpdateDoc function when using Redux and FireBase

PersonalSlice.js

 export const updatePersonal = createAsyncThunk("personal/updatePersonal", async (id, {getState})=>{
    const personalDoc = doc(db, "Personal", id)
    await updateDoc(personalDoc, getState().personal.updatePersonal );
});

Main.js

 const updateName = useSelector((state) => state.personal.updatePersonal.name);

const handleUpdateNameChange = (e) => {
        dispatch(changeUpdatePersonalName(e.currentTarget.value))
    }

const handleUpdateSubmit = (e) => {
        e.preventDefault();
        dispatch(updatePersonal({updateName , updateSurname, updateBirthday, updateStartDate, updateDepartment, updatePhone, updateMail}))
    }



 <Form onSubmit={handleUpdateSubmit}>
                        <p className="text-center" style={{ color: "#39ace7" }}>İsim</p>
                        <Form.Control 
                        size = "sm"
                            type="text"
                            name="updatePersonal"
                            onChange={handleUpdateNameChange}
                            value={updateName}
                            required
                            autoFocus
                        />

I can't send the data I want to update in the form to FireBase. My fault is most likely in the parameters.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you are starting a new project and/or are not required to have your Firebase data loaded into redux, you might want to give reactfire a try before trying react-redux-firebase. In reference to the above function call ,if the profile object contains a key or a list of keys as parameters, you can populate those parameters with the matching value from another location on firebase.

Setting config like this:

  userProfile: 'users', // where profiles are stored in database
  profileParamsToPopulate: [
    'contacts:users'
  ]
}

Results in profile with populated contacts parameter:

  displayName: 'ABC',
  email: 'abc@xyz.com',
  contacts: [
    {
      email: 'efg@xyz.com',
      displayName: 'EFG'
    },
     {
      email: 'pqr@xyz.com',
      displayName: 'PQR
    }
  ]
}

Please check the link here to understand the parameters call usage and related questions Update Data in Firebase and Update function in Firebase for reference.Also check the helpful documentation for configuration for redux-firebase

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!