Using React Suspense
How to enable it#
One of the goals of GQless is to embrace React Suspense & Concurrent Mode, however these features are still in development by the React team.
Until these features become widespread enough, you will need to opt-in for Suspense support via configuration. This can be done directly in hook, or via the defaults of the client.
Usage without Suspense#
All hooks return a $state object, when suspense support is not enabled.
Suspense & SSR#
React doesn't yet support suspense whilst rendering on the server, so react-ssr-prepass is used in our SSR functions:
And for that, reason we suggest using a slighty modified Suspense component:
And everything should work as you might expect.