import React from "react" import PropTypes from "prop-types" export const Stats = props => (

Stats

) Stats.propTypes = { stats: PropTypes.object } const Stat = props => (

{props.name} {props.count}

) Stat.propTypes = { name: PropTypes.string, count: PropTypes.number, }; const TorrentsStat = function(props) { if (props.data.torrentCount === undefined) { return (No torrents); } const percentage = Math.floor((props.data.torrentCountById * 100) / props.data.count); return ( {percentage}% with torrents   - {props.data.torrentCount} total ); } TorrentsStat.propTypes = { data: PropTypes.object };