const animals = [ { name: "cat", sound: "meow" }, { name: "dog", sound: "woof" } ]; function useAnimal(animal) { return [animal.name, function() { console.log(animal.sound); } ]; } export default animals; export { useAnimal }; ------- App Page ------------ mport React from "react"; import ReactDOM from "react-dom"; import animals, { useAnimal } from "./data"; const [catName, dogName] = animals; const { name, sound } = catName; console.log(useAnimal(catName)); const [animal, makeSound] = useAnimal(catName); console.log(makeSound()); console.log(makeSound()); makeSound();