Hi! I´am integrating webflow with react. I want to know if necessary to require the webflow.js file in my React App. If yes, How does I can do that? i´ve used require() but a “an error has occured” message appears inmediatly the page is showed.
@jmcataldo Could you elaborate on exactly how you’re trying to integrate Webflow and React? In a nutshell, I would expect you’ll have a hard time using Webflow-built stuff inside a React project, but it shouldn’t be too difficult to use React-built components within a Webflow project, provided you can hook them up with custom code/embeds.
How you include it will depend on exactly how you’re integrating it… but at a high level, Webflow’s bundle is configured and built specifically for the dependencies on your site (note: currently per-site, not per-page); if you look at the source of your published page, you’ll see at least 2 scripts included by webflow: jquery (currently 2.2.0), and the webflow.js bundle, which should have a cache-buster name like webflow.e4ebd3d34.js.
You’d need to include jQuery and the Webflow bundle in your app’s page; note these are bundled for use in a webpage, and are not intended to be used in a Node.js environment (you could probably get around this with jsdom). You can access the Webflow global; requiring this via a bundling tool will require a special hack, such as Webpack’s externals directive.
Ive decided to skip the interactions and additional behaviors provided by the webflow.js file. Ill import some react components that helps me to do the needed tasks ( validations, tool-tips, progress bar, etc )
I know it’s an old topic, but just wanted to let y’all know that I’ve created a tool that does that automatically - it migrates a Webflow project into a React app with a single command. Checkout the following link if this is what your’e looking for: https://github.com/DAB0mB/Appfairy