Please upgrade here. These earlier versions are no longer being updated and have security issues.

Embed Vanilla Forums in ReactJs app

Hello,

After succesfully installing the vanilla forum I am now trying to embed the forum on my ReactJs application. My plan is to route "/forum" of my app to a component that should contain a reference to my embed.js file of the Vanilla instalation.

The method that I tried is not working, could you please advise on how to embed in ReactJs app?


This is the way that I tried to embed the forum in my React component:


import * as React from 'react';

export class Forum extends React.Component {

  componentWillMount() {
     const script = document.createElement('script');
    
     script.type = 'text/javascript';
     script.src = 'http://mydomain.com:8082/js/embed.js';
     script.async = true;
    
     document.body.appendChild(script);
  }

  render() {

    return (
      <div className="vanilla-credit">
        <div className="vanilla-credit">
          <a className="vanilla-anchor" href="http://vanillaforums.com">
            Discussions by <span className="vanilla-logo">Vanilla</span>
          </a>
        </div>
      </div>
    );
  }
}

export default Forum;


Tagged:
Sign In or Register to comment.