react-fast-marquee
react-fast-marquee copied to clipboard
Error in Next.js
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
how are you rendering it? Can you provide sample code?
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>
)
}
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.
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'
.
Same error on Astro 4.4.9
For anyone looking for an alternative, this one works well with Astro: https://github.com/devnomic/marquee
Same here on Remix last version
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 />
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!