3 ms·
Stateless Functional Components in React! const ProgressMeter = ({ className, percentage }) => { const meterStyle = { width: `${Math.round(Ma
by madeofpalk 11y 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>
);
};