
Vanilla JS와 React JS로 click me 버튼을 클릭하면 total clicks의 수가 하나씩 증가하는 기능을 각각 만들어 비교해보자. Vanilla JS total clicks : 0 click me const button = document.getElementById('button'); const h3 = document.querySelector('h3'); let counter = 0; function handleClick() { counter += 1; h3.innerText = `total clicks : ${counter}`; } button.addEventListener('click', handleClick); Vanilla JS는 html을 만들고 js로 가져와서 다시 htm..
React
2023. 4. 24. 21:29