Getting Started
Getting Started: Using a React component
Our universal code can be installed on ANY website, however with JavaScript frameworks sometimes they need a slight tweak to make sure everything loads in the correct sequence.
Here is a quick snippet to get you started to you can import ReplyBox into any page:
import React, { useEffect } from "react";
const ReplyBox = () => {
useEffect(() => {
if (window.replybox.site) return;
window.replybox = {
// UPDATE SITE HERE
site: "J8M03mBNIO"
};
const script = document.createElement("script");
script.src = "https://cdn.getreplybox.com/js/embed.js";
script.async = true;
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
};
}, []);
return <div id="replybox"></div>;
};
export default ReplyBox;
Now simply use the following to import and display:
import ReplyBox from "./MyComponent";
<ReplyBox />
If you have any questions, do let us know.