푸딩 20일차

Seoyeon Kim·2021년 8월 20일
0

Fooding

목록 보기
22/22

1. 가격 콤마(,)

수정 전

const handlePriceInput = (text) => {
    setPrice(text.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","))
  }

수정 후

const handlePriceInput = (text) => {
    const unComma = text.toString().replace(/[^\d]+/g, '') // 
    const comma = unComma.toString().replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,')
    setPrice(comma)
  }

2. Validate

2-1. SaleWrittingPage

2-2. AithWrittingPage

0개의 댓글

관련 채용 정보