Installation

Install and configure the m0rphic React SDK in your project.

Install the Package

The SDK is available on npm as @m0rphic/react.

bash

Peer Dependencies

The SDK requires React 18 or later:

package.json

Note

If you're using Next.js 13+ or a modern React framework, these dependencies are already included.

TypeScript Support

The SDK is written in TypeScript and includes full type definitions. No additional @types packages are needed.

typescript

Bundle Size

The SDK is optimized for minimal bundle impact:

~8kb

minified + gzipped

Tree-shakable

import only what you use

Framework Setup

Next.js (App Router)

Add the provider to your root layout. Mark it as a Client Component:

typescript

Vite / Create React App

Wrap your app in the provider at the entry point:

main.tsx