You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is, for developers that use SWR, it will just work out of the box.
Brought to you by @promer94 and @shuding, this release includes a core refactoring that improves React 18 support by adopting APIs like useSyncExternalStore and startTransition internally. Especially when rendering UIs concurrently with React 18, this new SWR version ensures stronger UI consistency.
Worth note that the current stable 1.x version of SWR still works well in React 18.
This core change isn't breaking and does not affect React <=17 apps.
When using suspense: true with SWR on the server-side (including pre-rendering in Next.js), it's now required to provide the initial data via fallbackData or fallback. This means that you can't use Suspense to fetch data on the server side as of today, but either doing fully client-side data fetching, or fetch the data via the framework (such as getStaticProps in Next.js).
While Suspense for libraries is still experimental, this behavior might change before the 2.0 stable release. More discussions can be found here: #1906.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Highlights
Better React 18 Support (#1962)
This is, for developers that use SWR, it will just work out of the box.
Brought to you by @promer94 and @shuding, this release includes a core refactoring that improves React 18 support by adopting APIs like
useSyncExternalStore
andstartTransition
internally. Especially when rendering UIs concurrently with React 18, this new SWR version ensures stronger UI consistency.Worth note that the current stable 1.x version of SWR still works well in React 18.
This core change isn't breaking and does not affect React <=17 apps.
Breakings
Avoid using Suspense on the server-side (#1931)
When using
suspense: true
with SWR on the server-side (including pre-rendering in Next.js), it's now required to provide the initial data viafallbackData
orfallback
. This means that you can't use Suspense to fetch data on the server side as of today, but either doing fully client-side data fetching, or fetch the data via the framework (such asgetStaticProps
in Next.js).While Suspense for libraries is still experimental, this behavior might change before the 2.0 stable release. More discussions can be found here: #1906.
What's Changed
New Contributors
Full Changelog: 2.0.0-beta.1...2.0.0-beta.3
This discussion was created from the release 2.0.0-beta.3.
Beta Was this translation helpful? Give feedback.
All reactions