import { h } from 'preact'; import { useState, useEffect } from 'preact/hooks'; // import style from './style.less'; import actions from './../actions'; import Bundle from './../components/bundle'; interface Props { userId: string, offers: any[], getUserOffers: (userId: string) => void, } const User = ({ userId }: Props) => { const [offers, setOffers] = useState([]); useEffect(() => { actions.getOffers(userId).then(setOffers); }, [userId]); if (!offers.length) { return (
loading...
); } return (
{offers.map(Bundle)}
); }; export default User;