spread operator1 3. Spread Operator (Managing Array State) 2023.03.02 0. Background The reason that made me search for and use it is basically that I wanted to manage a state of an array through useState hook. It didn't work when I tried just updating the array with array functions like this: import {useState} from 'react'; const [tags, setTags] = useState([]); const setTags = (tag) => { setTags(tags.push(tag)); }; const removeTags = () => { setTags(tag.. 2023. 3. 2. 이전 1 다음