Skip to content

Instantly share code, notes, and snippets.

@RoySegall
Last active December 23, 2021 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoySegall/0c31f379f1b629e8d4a94a8a67816073 to your computer and use it in GitHub Desktop.
Save RoySegall/0c31f379f1b629e8d4a94a8a67816073 to your computer and use it in GitHub Desktop.
const Pokemon = () => {
const {id} = useParams();
const pokemon = useMemo(async () => {
try {
cosnt results = await getPokemon(id);
return results.data; // or watever...
} catch (e) {
console.log('There was an error', e);
return null;
}
}, [id]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment