import { h } from 'preact'; import PropTypes from 'prop-types'; const Channels = ({ activeChannelId, chatChannels, handleSwitchChannel }) => { const channels = chatChannels.map(channel => { const otherClassname = parseInt(activeChannelId, 10) === channel.id ? 'chatchanneltab--active' : 'chatchanneltab--inactive'; return ( ); }); return (
{channels}
); }; Channels.propTypes = { activeChannelId: PropTypes.number.isRequired, chatChannels: PropTypes.array.isRequired, handleSwitchChannel: PropTypes.func.isRequired, }; export default Channels;