react-fast-marquee icon indicating copy to clipboard operation
react-fast-marquee copied to clipboard

Error in Next.js

Open danteissaias opened this issue 1 year ago • 9 comments

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

danteissaias avatar Feb 22 '24 13:02 danteissaias

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

cabbage-cart avatar Feb 23 '24 07:02 cabbage-cart

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>
  )
}

scythewyvern avatar Feb 23 '24 13:02 scythewyvern

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.

ogabrielp avatar Apr 02 '24 21:04 ogabrielp

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'.

wottpal avatar Apr 12 '24 10:04 wottpal

Same error on Astro 4.4.9

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

raymelon avatar May 28 '24 10:05 raymelon

Same here on Remix last version

viclafouch avatar Jun 08 '24 08:06 viclafouch

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 />

zougari47 avatar Jun 12 '24 16:06 zougari47

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!

seancswanson avatar Aug 03 '24 22:08 seancswanson