Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad


React js - Componente pantalla hero, Apuntes de Informática

descripcion React js - Componente pantalla hero

Tipo: Apuntes

2020/2021

Subido el 20/09/2021

meiser-gamboa-cuello
meiser-gamboa-cuello 🇵🇪

6 documentos

1 / 3

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
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 <Redirect to="/" />;
}
const handleReturn = () => {
if( history.length <=2 ) {
history.push('/');
} else {
history.goBack();
}
}
const {
superhero,
publisher,
alter_ego,
first_appearance,
characters,
} = hero;
pf3

Vista previa parcial del texto

¡Descarga React js - Componente pantalla hero y más Apuntes en PDF de Informática solo en Docsity!

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