Exported components are designed to be framework-agnostic, but each framework has its own conventions and best practices for integration. This guide provides specific considerations for popular React frameworks.
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, webflow, ~/webflow, 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.
Exported components, which often rely on client-side JavaScript for interactions and styling, may not work directly with React Server Components (RSC). To use Webflow components in your React application, it’s recommended to:
"use client" directive to the component file.DevLinkProvider is in a client-side context (e.g., within a layout.tsx file marked as a client component) to enable all interactions.Next.js, with its server-side rendering (SSR) and static site generation (SSG) capabilities, requires some changes when integrating client-side DevLink components and interactions.
To support interactions, your application must be wrapped with the DevLinkProvider component.
When using the Next.js App Router in versions 13 and higher, you’ll need to:
DevLinkProvider in your root layout.tsx fileThe Next.js App Router uses React Server Components by default. For exported Webflow components that rely on client-side JavaScript for interactions and styling, you may need to add the "use client" directive at the top of your component files.
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 passing a custom component to the renderLink and/or renderImage props of the <DevLinkProvider> component.
Update the Next.js configuration to ensure Image components work with external URLs.
Remix is a full-stack web framework that prioritizes web standards and performance. When using DevLink with Remix:
useEffect or other client-side hydration techniques for dynamic content.global.css within your root app/root.tsx or a relevant stylesheet. Address any CSS conflicts with Remix’s default styles or your custom CSS.loader functions) by passing fetched data as props to your DevLink-wrapped components.Example
Gatsby is a static site generator for React. You can use DevLink components inside your Gatsby project for both static and interactive content. Follow the steps below to integrate DevLink.
window, animations, or JavaScript APIs and need to be hydrated on the client. Use useEffect or a mounted state guard to avoid hydration mismatches.Example
Import DevLink’s global stylesheet so your components render with the expected styles. You can do this in either:
gatsby-browser.tsx to apply styles on the client, orTo give all routes access to DevLink, wrap your app root element with DevLinkProvider. Add the wrapper to both gatsby-browser.tsx and gatsby-ssr.tsx.