This is a Next.js project bootstrapped with create-next-app
.
Changes are made to the default project, to test new features of Next.js 13 and React 18; app
routing files, server components, streaming (SSR), transitions.
For better demonstration, API fetches are delayed and NOT cached.
-
/posts
page demonstrates the component hierarchy and the usage ofSuspense
,Fallback
and streaming.- The common
layout
is in view, while posts are loading with theloading
component. - Posts are in view, while the
UserInfo
and theComments
are loading with their ownfallback
s. UserInfo
is in view, andComments
is in view.
- The common
-
/todos
page demonstrates an example of client-side state change causing a refetch to the data source while still making use of SSR.- By clicking the buttons:
ALL
,DONE
,NOT DONE
, url changes. (router.push
) - Next.js performs client-side navigation to the url, while data fetches are made by the server.
- Notice that the button colors change immediately, while the
TodoList
changes slowly. Also dimmed effect is shown, usingisPending
,startTransition
. Tryrouter.push
without them to compare.
- By clicking the buttons: