Need to wrap HTML & JS in div to write code, but you don't need one. Instead, use react frament <>your code</>.
const agentNumber = get(data, 'agent_contact_s_lower', '');
const resultCallForPrice = get(data, 'call_for_price', '');
let callForPriceCheck;
if (resultCallForPrice === 'yes') {
callForPriceCheck = (
<>
<a href={`tel:${agentNumber}`}>Call for price</a>
</>
);
} else {
callForPriceCheck = <>{accounting.formatMoney(listingPrice, 'RM ', 0)}</>;
}
return (
<>
<div className="mobile-view">
<p className="card-price">{callForPriceCheck}</p>{' '}
<div className="desktop-view">
<p className="card-price">{callForPriceCheck}</p>{' '}
</>