react-multi-carousel icon indicating copy to clipboard operation
react-multi-carousel copied to clipboard

NextJS 13

Open maurorpo opened this issue 2 years ago • 14 comments

I found this issue when using RMC with Next Js 13

Imagen de WhatsApp 2023-04-21 a las 15 45 46 Imagen de WhatsApp 2023-04-21 a las 15 46 45

maurorpo avatar Apr 24 '23 13:04 maurorpo

I had the same problem. You should use the "use client" declaration on top of the file, where you import the Carousel component Like this

DevDugg avatar Apr 27 '23 20:04 DevDugg

i try but this show me the console

image

maurorpo avatar Apr 27 '23 20:04 maurorpo

When you are mapping in React or Next, you must always provide a keyattribute to the element that you're returning. It should look like this:

array.map((item, index) => ( <div key={index}>...</div> ));

It is necessary to do that, because React needs the key to recognise the elements during re-renders.

You can use any number instead of index, just make sure it is unique.

You can read more in the official docs

DevDugg avatar Apr 27 '23 20:04 DevDugg

thanks for answer, but that is not the error

image

i fixed that warning but i hava this ( image )

maurorpo avatar Apr 27 '23 20:04 maurorpo

Same answer, use the use client declaration on top of the file which gives the error

DevDugg avatar Apr 28 '23 17:04 DevDugg

Hello, I have the same problem, but I need to render the carousel on server, any other way to fix it?

SaerwenLis avatar May 14 '23 12:05 SaerwenLis

@SaerwenLis What carousel are you using? It is possible to render it on server if the package you're using supports SSR.

DevDugg avatar May 14 '23 13:05 DevDugg

@SaerwenLis If you need to render it on server, how about hybrid rendering - making carousel separatlely on client component by using 'use client' then just importing on server components/pages? I'm not sure but hope it can help!

yjleeinkr avatar May 22 '23 17:05 yjleeinkr

@yjleeinkr I already solved it ty

SaerwenLis avatar May 22 '23 17:05 SaerwenLis

@SaerwenLis How did you solve it? I run into the same problem too and I'm trying to figure what's happening

sqle157 avatar May 26 '23 00:05 sqle157

It does support sever-side, but I prefer using the client because you have to really on the headers with device-agent which isn't very accurate like basic media queries.

jdrew-byte avatar Jun 09 '23 21:06 jdrew-byte

I had the same problem. You should use the "use client" declaration on top of the file, where you import the Carousel component Like this

thanks for the solution.

naeem23 avatar Aug 09 '23 04:08 naeem23

Does ssr working for you ? This lib not working without "use client" and giving you an option ssr={true} which not working cause we can use it only by "use client" how to make it work in ssr any ides ?)

Arthur7711 avatar Aug 27 '23 13:08 Arthur7711

You should use ssr with the deviceType parameter

etabard avatar Feb 22 '24 11:02 etabard