[Framer-motion] motion/react vs motion/react-client 비교
·
📚 STUDY/WEB
Next.js App Router에서 Motion을 사용하다 보면 다음 두 가지 방식이 있다.// 일반적인 방식"use client";import { motion } from "motion/react";// React Server Components 환경import * as motion from "motion/react-client";둘의 차이는 단순히 import 경로가 아니라 컴포넌트가 어느 렌더링 경계에 배치되는지, 서버와 클라이언트에서 어떤 작업이 수행되는지, 브라우저로 전달되는 JavaScript의 범위가 어떻게 달라지는지에 있다.1. motion/reactmotion/react를 사용하려면 Motion을 사용하는 컴포넌트에 "use client"를 선언해야 한다."use client";impo..