Hacker News new | ask | show | jobs
by madeofpalk 3768 days ago
Stateless Functional Components in React!

    const ProgressMeter = ({ className, percentage }) => {
      const meterStyle = {
        width: `${Math.round(Math.min(Math.max(percentage, 0), 1) * 100)}%`,
      };

      return (
        <div className={cx('root', className)}>
          <div className={cx('meter')} style={meterStyle}/>
        </div>
      );
    };