#async component

1 messages · Page 1 of 1 (latest)

stiff sparrow
#

Can you show how you're using the list component? I just tried an simple example and it worked for me

simple gust
#

I do import List from <path>
Then this in my page

stiff sparrow
#

Can you show the article component?

simple gust
#

Btw you said this was a hack. Do we now when react will support async components ?

stiff sparrow
#

Next.js supports the async components but the types havent been updated yet. It should be soon

simple gust
#

Oh ok

#

Good

stiff sparrow
#

hmm I cant find a way to reproduce the error, do you want to create a codesandbox?

stiff sparrow
#

what happens if you remove this line
import { useEffect, useState } from "react"; from list.tsx ?

simple gust
#

No changes

#

They're code i forgot to remove when i was trying to fix this.

stiff sparrow
#

found it pretty sure

#

In your page.tsx

#

Either remove 'use client' or remove async from the function

#

and layout/filter.tsx needs to be marked with 'use client' because tis a client component

simple gust
#

I'll try. But for now i'm eating

#

Ok. First i can't remove async from the function List because otherwise it cannot use await

stiff sparrow
#

not from list

#

from the page

#

from page.tsx

simple gust
#

Nope still same error

#

I've moved use client from page.tsx to list.tsx and filter.tsx because it needed it as well

stiff sparrow
#

list shouldnt have use client thats gonna cause an error

simple gust
#

Ok it works but for some reason the style isn't applied to filter.tsx

stiff sparrow
#

do npm i next@latest and it should work

#

there was a bug with styles in client components