import React from "react"; import PropTypes from "prop-types"; export const TorrentsStat = ({ count, torrentCount, torrentCountById }) => { if (torrentCount === undefined) { return No torrents; } const percentage = Math.floor((torrentCountById * 100) / count); return ( {percentage}% with torrents   - {torrentCount} total ); }; TorrentsStat.propTypes = { count: PropTypes.number, torrentCount: PropTypes.number, torrentCountById: PropTypes.number, };