λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
React

[React] onClick ν•¨μˆ˜ μ‚¬μš©λ²•

by dong_su 2023. 12. 12.
      <div className='list'>
        <h4>{title[0]} <span onClick={() => console.log(1)}>πŸ‘</span>{good}</h4>
        <p>2μ›” 17일 λ°œν–‰</p>
      </div>

-> μœ„ μ½”λ“œμ—μ„œλŠ” ν™”μ‚΄ν‘œν•¨μˆ˜λ₯Ό μ΄μš©ν–ˆμ§€λ§Œ, function(){}도 κ°€λŠ₯ν•˜κ³  λ”°λ‘œ ν•¨μˆ˜λ₯Ό μ •μ˜ν•˜κ³  {}μ•ˆμ— ν•¨μˆ˜λͺ…을 κΈ°μž…ν•΄λ„ κ°€λŠ₯ν•˜λ‹€.

-> onClick μ•ˆμ—λŠ” ν•¨μˆ˜λ§Œ λ“€μ–΄κ°ˆ 수 μžˆλ‹€.