Next.js Discord

Discord Forum

Promise Explanation - Data fetching

Unanswered
Perro de Presa Canario posted this in #help-forum
Open in Discord
Perro de Presa CanarioOP
I am trying to fetch company data for the current User. I get the current user through the session. Importing the function into my page I want to display the company data in the default values. but somehow I cannot access them. How could i make them accessable?

19 Replies

Spectacled bear
What is the value of usersWithCompany?
what does it mean?
but somehow I cannot access them
@Spectacled bear What is the value of usersWithCompany?
Perro de Presa CanarioOP
those are the values
Maybe my approch is completly wrong Im not sure
@Spectacled bear what does it mean? > but somehow I cannot access them
Perro de Presa CanarioOP
That's what i mean
you need to await for getCompan....
add await before the getter function
Perro de Presa CanarioOP
I was planning on using it as 'use client" page.
Due to using const [isPending, startTransition] = useTransition() and other things
u seperate form, and the main component
fetch data in server component
create a new client component for form
pass any data if you have to the form from server component
Perro de Presa CanarioOP
oh i see
Ill give it a try
thanks man
no worries, let us know once you've solved it
Perro de Presa CanarioOP
will do