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 (