그나저나, useEffect 에서 Server Actions 호출 할 수 있는 거 나만 몰랐지 또.

https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#useeffect

컴포넌트가 마운트되거나 종속성이 변경될 때 서버 액션을 호출하기 위해 React useEffect 훅을 사용할 수 있습니다. 이는 글로벌 이벤트에 의존하거나 자동으로 트리거되어야 하는 변이에 유용합니다. 예를 들어 앱 바로 가기를 위한 onKeyDown, 무한 스크롤을 위한 교차점 관찰자 후크, 컴포넌트가 마운트되어 뷰 수를 업데이트할 때 등이 있습니다:

라고 합니다.

0

If you have a fediverse account, you can quote this note from your own instance. Search https://hackers.pub/ap/notes/0196b931-e7e0-72d3-87de-886f2d224423 on your instance and quote it. (Note that quoting is not supported in Mastodon.)