justin-chu / react-fast-marquee

A lightweight React component that harnesses the power of CSS animations to create silky smooth marquees.
https://react-fast-marquee.com
MIT License
1.16k stars 95 forks source link

Error in Next.js #100

Open danteissaias opened 6 months ago

danteissaias commented 6 months ago
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
cabbage-cart commented 6 months ago

how are you rendering it? Can you provide sample code?

scythewyvern commented 6 months ago

same with remix v2.7.2

import Marquee from 'react-fast-marquee'

export function Section() {
  return (
    <section>
      <Marquee>
        I can be a React component, multiple React components, or just some text.
      </Marquee>
    </section>
  )
}
ogabrielp commented 5 months ago

Also happening to me in Astro 4.5.12. My code is very similar to @scythewyvern's, but I'd like to add some context here: if I change the component to something invalid, such as <Marquee2>Hey!</Marquee2>, I get a different error (not the one attached to this issue), which is totally expected.

However, when I switch it back to Marquee, the original error doesn't happen anymore. I can alter the content of Marquee and I can even add props - all changes that are streamed through HMR work fine and I can see them get applied. As soon as I full-refresh the page, though, it stops working and raises the error mentioned above.

wottpal commented 4 months ago

Getting the same error. Did someone find a workaround?

Update: In Next.js, it seems to fix it for me when making it a client component via 'use client'.

raymelon commented 3 months ago

Same error on Astro 4.4.9

For anyone looking for an alternative, this one works well with Astro: https://github.com/devnomic/marquee

viclafouch commented 3 months ago

Same here on Remix last version

zougari47 commented 2 months ago

If you're using Next js try to use use client directive. For Astro make the code of Marquee in a React component and use the client directive

<MyMarquee client:load />
seancswanson commented 1 month ago

Same error on Astro 4.4.9

For anyone looking for an alternative, this one works well with Astro: https://github.com/devnomic/marquee

This component worked great for me when I encountered this issue!