Skip to main content
The WAX SDK works seamlessly with modern JavaScript frameworks. Learn how to integrate WAX into your React, Next.js, Vue, Nuxt, or Node.js application.

React integration

Integrate WAX into React applications.

React with Vite

Vite provides automatic WASM support:

React Context

Create a context for WAX instance:
WaxContext.tsx
Use the context in components:
App.tsx

Custom hook

Create a reusable hook for WAX operations:
useHiveAccount.ts
Use the hook:

Next.js integration

Integrate WAX with Next.js applications.

Configuration

Add to next.config.js:
next.config.js

Client component

Use WAX in a client component:
app/components/WaxDemo.tsx

Server actions

Use WAX in server actions:
app/actions.ts
Use server actions in components:
app/components/AccountDisplay.tsx

API routes

Create API routes with WAX:
app/api/account/[username]/route.ts

Vue integration

Integrate WAX with Vue applications.

Vue with Vite

Basic Vue 3 component:
App.vue

Composable

Create a composable for WAX:
composables/useWax.ts
Use the composable:
AccountInfo.vue

Nuxt integration

Integrate WAX with Nuxt applications.

Basic setup

Nuxt component with SSR support:
pages/index.vue

Server API

Create server API endpoints:
server/api/account/[username].ts
Use the API in components:
pages/account/[username].vue

Node.js integration

Use WAX in Node.js applications.

Basic setup

Ensure your package.json has:
package.json
Basic Node.js script:
index.ts

Express.js API

Create an API with Express:
server.ts

CLI application

Create a command-line tool:
cli.ts
Run the CLI:

Best practices

Initialize once

Create WAX instances once and reuse them:

Error handling

Always handle errors:

Loading states

Show loading indicators during WASM initialization:

Next steps

Explore complete examples: