import React from 'react'; export default function AmazonCalculator() { const [price, setPrice] = React.useState(0); const [cost, setCost] = React.useState(0); const [shipping, setShipping] = React.useState(0); const [amazonFee, setAmazonFee] = React.useState(0); const profit = price - cost - shipping - amazonFee; const profitMargin = price ? (profit / price) * 100 : 0; return (

Amazon Profit Calculator

setPrice(parseFloat(e.target.value) || 0)} /> setCost(parseFloat(e.target.value) || 0)} /> setShipping(parseFloat(e.target.value) || 0)} /> setAmazonFee(parseFloat(e.target.value) || 0)} />

Results

Profit: ${profit.toFixed(2)}

Profit Margin: {profitMargin.toFixed(2)}%

); }