createresource why is this error even on a basic example
i dont know why event the basic example is error
31 Replies
use
data()?.name
, the resource is undefined initiallyBut why on example on official website doesnt have '?'?
🤷 typo maybe? What example were you looking at?
still error no data displayed
check what the fetch returns
Suspense will only catch during load, not once the resource finished loading. So maybe your
resonse.json()
is undefined?yeah i forgot the await on that but still no data displayed
hmm. does
console.log(await response.json())
display data?
inside the thisProject
functioni have solution on this before but for me i think this is not the right way. here the solution i made on other route
i bellieve this solution is so redundant
this
then shouldn't it be
data()[0].name
?
instead of data().name
same error
here is the whole code
@navi.ToTskie you can put ``` around it to make it more readable.
like:
```tsx
your code
```
no with three `
yes, and now you can add
tsx
after the first three ` to add syntax highlighting :)
on the same line
like this:
```tsx
your code
```how to new line here?
shift + enter
ahhh
shttt hahaha
thanks for i learn new on discord hahaha
you're welcome :)
This helps a lot when reading code. You're doing everyone a favor.
yeah i always wanted to learn this before like coloring the code on discord
But I have to disappoint you. I don't know whats wrong with your code
anyways that is the code where it might configure it wrong?
awp
can you put data in a create effect and print its value?
same error 😦
do you have this kind of error on createresource?
i can solve it like this but it looks like redundant
no
remove the code in the template that produces this error. The console log in the effect should be working.
createeffect does the same thing as
I don't know what you mean by this .-.
nvm thanks 😄