const Price = (props) => { const price = props.children.toLocaleString('en', { style: props.showSymbol ? 'currency' : undefined, currency: props.showSymbol ? 'USD' : undefined, maximumFractionDigits: props.showDecimals ? 2 : 0, }); return {price} }; Price.propTypes = { className: React.PropTypes.string, children: React.PropTypes.number, showDecimals: React.PropTypes.bool, showSymbol: React.PropTypes.bool, }; Price.defaultProps = { children: 0, showDecimals: true, showSymbol: true, }; const Page = () => { const lambPrice = 1234.567; const jetPrice = 999999.99; const bootPrice = 34.567; return (

One lamb is {lambPrice}

One jet is {jetPrice}

Those gumboots will set ya back {bootPrice} bucks.

); };