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>
const FavoriteAnimals = props => {
const firestore = useFirestore();
const baseRef = firestore().collection('animals');
const [isAscending, setIsAscending] = useState(true);
const query = baseRef.orderBy('commonName', isAscending ? 'asc' : 'desc');
const [startTransition, isPending] = useTransition({
timeoutMs: 1000
});
const toggleSort = () => {
startTransition(() => {
setIsAscending(!isAscending);
});
};
const addNewAnimal = commonName =>
baseRef.add({
commonName