Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Counter = props => {
const firestore = useFirestore();
const serverIncrement = firestore.FieldValue.increment;
const ref = firestore().doc('count/counter');
const increment = amountToIncrement => {
ref.update({
value: serverIncrement(amountToIncrement)
});
};
const { value } = useFirestoreDocData(ref);
return (
<>
<button> increment(-1)}>-</button>
<span> {value} </span>
<button> increment(1)}>+</button>
);
};