We want to show you how to successfully embed a LeadForm into a React site. The following process will show you how to embed a Simple embed into your site.

Start by copying the embed code from the Add to Website step.

You can create a SimpleForm component (in a file called SimpleForm.js) and add the unique elements from your the embed code for your form. We have commented above the lines where you need to add your forms' unique code.

import React, { Component } from 'react';class SimpleForm extends Component {
componentDidMount() {
if (document.getElementById('lf-load-scripts') === null) {
var s = document.createElement('script');
s.id = 'lf-load-scripts';
s.type = 'text/javascript'; // Replace with your forms JS src root //
s.src = 'https://d2erq0e4xljvr7.cloudfront.net/assets/js/leadformly-embed_advance.min.js';

} render() {
return (

}export default SimpleForm; 

To add the Component to your React app, import the "SimpleForm" component into the parent component (App in this example).

import React, { Component } from 'react';
import SimpleForm from './SimpleForm';class App extends Component {
render() {
return (

}export default App;

With the above steps in place, you can successfully run your Lead Form in a React app.

Did this answer your question?