Josh Birdwell Josh Birdwell -4 years ago 181
React JSX Question

How can I set multiple attributes on a firebase object?

I am using a library called redux-firebasev3 to make three separate set calls to firebase.

for(let object of array) {
firebase.set(`/object/${id}/attr1`, attr1);
firebase.set(`/object/${id}/attr2`, attr2);
firebase.set(`/object/${id}/attr3`, attr3);

The array has a length of 32. When it gets to about the 8th to the last object chrome dev tools freeze up and crash. Is there a better way I should be making these calls? What could be the reason for the failure? I can't see errors because dev tools crash.

Here is the link to set function in the library.

Answer Source

Not sure if I understand correctly, but are you looking for this?

firebase.set(`/object/${id}`, { attr1: attr1, , attr2: attr2, attr3: attr3 });
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download