| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
- MySQL
- JSX
- route
- server
- Context
- priority_queue
- UE5
- Callback
- Props
- DP
- leetcode
- 비트연산
- React
- nodeJS
- Navigation
- bit
- css
- component
- count
- array
- BinaryTree
- treenode
- state
- queue
- node.js
- event
- map
- axios
- c++
- routes
- Today
- Total
목록array (2)
우사미 코딩
https://state-updates.vercel.app/ State Updates state-updates.vercel.app 참고 페이지 1. Array 1) 특정 index에 새로운 데이터 추가하기 2) 배열에서 특정값 제거하기 - filter함수 사용 2. Object Array 1) 특정 object의 value 변경하기 - map함수 사용 2) object에서 key제거하기 (...rest) 3) object에서 key추가하기
import { useState } from "react"; function getRandomAnimal(){ const animals = ['bird','cat','cow','dog','gator', 'horse']; return animals[Math.floor(Math.random() * animals.length)]; } function App(){ const[animals, setAnimals] = useState([]); const handleClick = () =>{ setAnimals([...animals, getRandomAnimal()]); console.log(animals); } return ( Add animal {animals} ); } export default App; lin..