import React from 'react'; import {useLocation} from 'react-router-dom'; import planes from './planes.json'; import './plane.css'; const Planes = () => { const route = useLocation().pathname.replaceAll("/flugzeug/", ""); const plane = planes.find(p => p.category + p.name === route); const imgPath = process.env.PUBLIC_URL + '/img/' + plane.category + plane.img; return (
{ plane ? <>

{plane.name}

{'Bild

{plane.description}

:

Flugzeug nicht gefunden.

}
); } export default Planes;