Getting Started

Installation

npm
yarn
pnpm
bun
npm install lynx-console

Peer dependencies

npm
yarn
pnpm
bun
npm install @lynx-js/react @lynx-js/types
npm install -D @types/react

0. Configure your build (required)

Add this to your lynx.config.ts:

lynx.config.ts
export default defineConfig({
  source: {
    define: {
      console: 'globalThis.console',
      fetch: 'lynx.fetch',
    },
  },
});
  • console — iOS JSC injects a console that is not globalThis.console. Without the replacement, initLogMonitor() has no effect on iOS.
  • fetch — depending on your build setup, network requests may not be logged unless it is replaced with lynx.fetch.

1. Initialize the monitors

Call these at your app's entry point, before LynxConsole renders.

src/index.tsx
import {
  initLogMonitor,
  initMainThreadConsole,
  initNetworkMonitor,
  initPerformanceMonitor,
} from 'lynx-console/setup';

initLogMonitor();
initMainThreadConsole();
initNetworkMonitor();
initPerformanceMonitor();
WARNING

The main thread console builds on top of the log monitor, so initLogMonitor() must be called before initMainThreadConsole().

Tabs are not rendered for monitors you did not initialize.

2. Render the component

src/App.tsx
import LynxConsole from 'lynx-console';

function App() {
  return (
    <view>
      {/* your app */}
      <LynxConsole theme="light" safeAreaInsetBottom="34px" />
    </view>
  );
}

You can split it out of the main bundle with lazy:

src/App.tsx
import { lazy, Suspense } from '@lynx-js/react';

const LynxConsole = lazy(() => import('lynx-console'));

function App() {
  return (
    <view>
      {/* your app */}
      <Suspense>
        <LynxConsole theme="light" safeAreaInsetBottom="34px" />
      </Suspense>
    </view>
  );
}

Run the app, tap the floating button, and the panel opens.

Next steps