반응형
프롭스
-
state 개별 숫자 증가, props프레임워크/리액트 React 2023. 1. 19. 01:09
1. 과제 1-1. 반복문 처리 없이, 👍 클릭시 개별적으로 숫자 증가 구현하기 /*eslint-disable*/ //경고메세지가 뜨는 eslint 기능을 꺼준다. import './App.css'; import {useState} from 'react'; function App() { let [글제목, 글제목변경] = useState(['남자코트 추천', '강남 우동맛집', '파이썬독학']); let [좋아요, 좋아요변경] = useState([0,0,0]); let [modal, setModal] = useState(false); return ( ReactBlog {글제목[0]} { let good = [...좋아요]; good[0] = good[0] + 1; 좋아요변경(good) } }>👍 {좋아요..