import {h} from 'preact'; import {findComments} from '../api/api'; import {useState, useEffect} from 'preact/hooks'; function Comment({comments}) { if (comments !== null && comments.length === 0) { return
No comments yet
; } if (!comments) { return
Loading...
; } return (
{comments.map(comment => (
{!comment.photoFilename ? '' : ( )}
{comment.author}
{comment.text}
))}
); } export default function Conference({conferences, slug}) { const conference = conferences.find(conference => conference.slug === slug); const [comments, setComments] = useState(null); useEffect(() => { findComments(conference).then(comments => setComments(comments)); }, [slug]); return (

{conference.city} {conference.year}

); }