

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!


import React, { useMemo } from 'react'; import { useParams, Redirect } from 'react-router-dom'; import { getHeroById } from '../../selectors/getHeroById'; export const HeroScreen = ({ history }) => { const { heroeId } = useParams(); const hero = useMemo(() => getHeroById( heroeId ), [ heroeId ]); if ( !hero ) { return ; } const handleReturn = () => { if( history.length <=2 ) { history.push('/'); } else { history.goBack(); } } const { superhero, publisher, alter_ego, first_appearance, characters, } = hero;
return (
{ superhero }
Alter ego: { alter_ego } Publisher: { publisher } First appearance: { first_appearance }
Characters
{ characters }
Return