Skip to content
Discussion options

You must be logged in to vote

Thank you for your codesandbox link! The cause of SyntaxError: Unexpected token < in JSON at position 0 is that your useSWR doesn't have fetcher passed in. So it uses the default fetch function, which can't fetch the key since it's not a URL.

You can do this:

useSWR('key', null)

to avoid that behavior.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jonathanstanley
Comment options

Answer selected by jonathanstanley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants