Skip to main content
The GBG GO Native Bridge is a browser-only library. It requires window and browser APIs that are not available during server-side rendering (SSR).
All bridge code must execute on the client. The bridge cannot run on the server.
In the App Router, components are server-rendered by default. Because the bridge needs window, you have to opt the relevant subtree into the client with 'use client' — typically by wrapping BridgeProvider in a small client-only component.

Mark bridge components as client-only

The wrapper itself is a client component that just renders BridgeProvider:
The 'use client' directive ensures the BridgeProvider and all bridge-related code only runs in the browser.

Using hooks in client components

Any component that calls a bridge hook also needs 'use client'. From there, the hooks behave exactly as they do outside Next.js:

Dynamic import fallback

If you need to conditionally load bridge code:

Pages Router

Since Pages Router components are client-rendered by default, the bridge works without additional configuration.

Things to avoid

Environment detection during SSR

If you need to know the environment during SSR (e.g., for conditional rendering), pass it as a prop from the client:
This avoids hydration mismatches by starting with 'standalone' and updating on the client.