Next.js Discord

Discord Forum

Loading.jsx for client component

Unanswered
Pacific herring posted this in #help-forum
Open in Discord
Avatar
Pacific herringOP
I'm relatively new to nextjs. So I wanted to ask, if I fetch my data from a 3rd party API in a client component. Will the loading.jsx and error.jsx file handle the loading and error state

1 Reply

Avatar
French Spaniel
use SWR for fetching data in client component, you will have error and loading state with SWR library, this is what NextJs recommends.