React

 

 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

 

//통화 변경
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

export const currencyFormatterUSD = new Intl.NumberFormat("en-US", {
  style: "currency",
  currency: "USD",
});


export const currencyFormatterKR = new Intl.NumberFormat("ko-KR", {
    style: "currency",
    currency: "KRW",
  });
  

 


 

import { currencyFormatterKR } from "../utils/formatting";

export default function MealItem({meal}) {

  return (
    <li className="meal-item">
        <article>
            <img src={`http://localhost:3000/${meal.image}`} />
            <div>
                <h3>{meal.name}</h3>
                <p className="meal-item-price">₩{currencyFormatterKR.format(meal.price)}</p>
                <p className="meal-item-description">{meal.description}</p>
            </div>
            <p className="meal-item-actions">
              <button>장바구니 추가</button>
            </p>
        </article>
    </li>
  )

}

 

 

about author

PHRASE

Level 60  라이트

He who has been bitten by a snake is afraid of an eel. (뱀에 물린 후 새끼줄 보고 놀란다.)

댓글 ( 0)

댓글 남기기

작성