Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 3x 3x 3x 1x 1x 1x 3x | import { useState } from "react"; export function useCustomerImages() { const customerImages = [ "/images/customers/customer1.png", "/images/customers/customer2.png", "/images/customers/customer3.png", "/images/customers/customer4.png", "/images/customers/customer5.png", ]; const [customerImage, setCustomerImage] = useState("/images/customers/empty.png"); const setRandomCustomerImage = () => { const randomIndex = Math.floor(Math.random() * customerImages.length); const randomCustomer = customerImages[randomIndex]; setCustomerImage(randomCustomer); }; return { customerImage, setRandomCustomerImage }; } |