import { IonPage, IonContent, IonHeader, IonTitle, IonToolbar, IonFooter, IonImg, IonGrid, IonRow, IonCol, IonButtons, IonBackButton, useIonViewWillEnter } from '@ionic/react'; import { useParams } from 'react-router'; import React, { useState } from 'react'; import './Capsule.css'; import { CapsuleInfo, getCapsule} from '../data/CapsuleInfo'; import EnciclopediaPR from '../assets/EnciclopediaPR.png'; const Capsule: React.FC = () => { const [capinfo, setCapsule] = useState(); const params = useParams<{ id: string }>(); useIonViewWillEnter(() => { const capsule = getCapsule(parseInt(params.id, 10)); setCapsule(capsule); }); return ( Cápsula {capinfo ? ( <>

{capinfo.title}

{capinfo.content}

) : (
Capsule not found
)}
); }; export default Capsule;