why can't i map over this api response?
Unanswered
Checkered Giant posted this in #help-forum
Checkered GiantOP
guessing because the response hasn't finished by the time map runs
62 Replies
Checkered GiantOP
@Checkered Giant Click to see attachment
you can make the page async and await the plant search.
Checkered GiantOP
hmm im just doing this as a babystep towards having that hardcoded search come from an input
just have not made the input yet
would i need to make the page async in that situation?
i should probably just look up next api tutorial
@DirtyCajunRice | AppDir you can make the page async and await the plant search.
Checkered GiantOP
how would i do that?
@Checkered Giant how would i do that?
add the word async before function, and the word await before plant search.
@DirtyCajunRice | AppDir add the word async before function, and the word await before plant search.
Checkered GiantOP
theres a couple functions
@Checkered Giant theres a couple functions
the page. the entire page
the Home function
Checkered GiantOP
and await before the function definition of plant search?
or
const plants = plantSearch() @DirtyCajunRice | AppDir ?Checkered GiantOP
now im getting this
do you have “use client†at the top?
Checkered GiantOP
nope
why is it necessary?
this client server stuff is so confusing to me still
you dont want client
Checkered GiantOP
ah
can you re-paste the file now that its edited
Checkered GiantOP
i figured i was doing this completely wrong
move the plant search function out of the component
like move it above
and what is the error when you hover over item? that its not typed i assume?
Checkered GiantOP
yea not typed
same error
thats really really odd
Checkered GiantOP
ah maybe because im not throwing in a key
is this it?
1: add : any
2 yes add key
Checkered GiantOP
kk
Checkered GiantOP
awesome thank you 🙂 now just have to figure out this unconfigured host image
but should be easy
@Checkered Giant awesome thank you 🙂 now just have to figure out this unconfigured host image
docs search image next config
its in the config.ts
Checkered GiantOP
yea
nailed it
Checkered GiantOP
bit confused by the port and pathname values
is pathname
/image/o/**oh schnikeys it worked
hahaha
Checkered GiantOP
well thats pretty cool, thats way easier than spinning up proxy server
so now if i want to stop hardcoding it to search for rose, and instead search for an input
i'd make Home not async again
make another component called PlantSearchList and make that async
Checkered GiantOP
cool cool