function MassConverter() { const [kilograms, setKilograms] = useState(''); const [result, setResult] = useState(null); const convert = () => { const kg = parseFloat(kilograms); setResult({ grams: (kg * 1000).toFixed(2), milligrams: (kg * 1000000).toFixed(2), pounds: (kg * 2.20462).toFixed(4), ounces: (kg * 35.274).toFixed(4), tons: (kg / 1000).toFixed(6), }); }; return (

⚖️ Mass/Weight Converter

setKilograms(e.target.value)} placeholder="1" />
{result && (
Grams: {result.grams}
Milligrams: {result.milligrams}
Pounds: {result.pounds}
Ounces: {result.ounces}
Metric Tons: {result.tons}
)}
); } // Export to global registry window.MassConverter = MassConverter;