Framework integrations
DevLink components are React-based and work with any modern React framework. This guide covers specific integration details for popular frameworks.
Next.js
DevLink works with all Next.js apps whether you’re using the Pages Router or the App Router. The steps below will help you configure DevLink global styles and the <DevLinkProvider>
which may be necessary for supporting components with Webflow interactions.
App Router
Pages Router
When using the Next.js App Router (Next.js 13+), you’ll need to:
- Import and set up the
<DevLinkProvider>
in your root layout file - Import global styles from DevLink
The App Router uses React Server Components by default. While most DevLink components work as Client Components, you may need to add the "use client"
directive at the top of your component files that use state or browser-specific APIs.
Custom Link and Image components
Some frameworks like Next.js provide their own Link and Image components for use in applications. You can choose to override DevLink’s builtin Link
and Image
components with the ones from Next.js by following the steps below.
First, create custom components that will wrap the Next.js Link
and/or Image
components:
For the Next.js Image
component to work with external URLs, update next.config.js
(more details on their official docs).
Finally, pass the custom components to the renderLink
and/or renderImage
props of the <DevLinkProvider>
component that wraps your application at the root.
Remix
DevLink works with Remix, but requires some configuration due to its server-first approach.
With Remix, import styles using the links export rather than importing the CSS file directly.
React Router
For applications using React Router (without Next.js or Remix), integrate DevLink as follows:
Vite and Create React App
For React apps built with Vite, or Create React App projects, the integration is straightforward:
Gatsby
For Gatsby sites, wrap your application with the DevLinkProvider
in your root layout component:
Common integration patterns
Regardless of the framework you’re using, follow these patterns to successfully integrate DevLink:
Ensure your import paths correctly resolve to your DevLink directory. Adjust import paths based on your project structure (for example, @/DevLink
, ~/DevLink
, or relative paths).
DevLink components are fully compatible with server-side rendering. Just make sure to wrap your application with DevLinkProvider at the root level.
Some frameworks may need configuration to prevent duplicate CSS imports. Use each framework’s recommended approach for CSS management.
DevLink generates type definitions for each Webflow component. Ensure your tsconfig.json
includes the DevLink directory *.ts
files.