Next.js Discord

Discord Forum

How to use react bits with nextjs

Unanswered
Cicada killer posted this in #help-forum
Open in Discord
Cicada killerOP
So I went on to react bits and copied this AnimatedList component, I installed motion which was mentioned as the dependency and tw-animate-css but I still get an error saying motion/react AND tw-animate-css were not found
Full error:
Build Error

Module not found: Can't resolve 'motion/react'
./src/components/AnimatedList.tsx (4:1)

Module not found: Can't resolve 'motion/react'
  2 |
  3 | import React, { useRef, useState, useEffect, ReactNode, MouseEventHandler, UIEvent } from 'react';
> 4 | import { motion, useInView } from 'motion/react';
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5 |
  6 | interface AnimatedItemProps {
  7 |   children: ReactNode;

Import trace:
  Server Component:
    ./src/components/AnimatedList.tsx
    ./src/app/page.tsx

https://nextjs.org/docs/messages/module-not-found

same thing for tw-animate-css

what am i doing wrong?

thanks

0 Replies