MERN #5

jaeha_lee·2023년 4월 28일
0
import React,{useState} from 'react';
	....
  const [goalList,setGoalList]= useState([
    {id: "cg1", text : "Finish the Course"},
    {id: "cg2", text : "Learn all about the course main"},
    {id: "cg3", text : "Help other students in Q&A"},
  ]);
  ...

이처럼 useState는 2개의 값을 return 하는데,
첫번째(goalList)는 최신 상태 snap shot이고
두번째(setGoalList)는 스 상태 snap shot을 업데이트 하는 함수

0개의 댓글