Hey, so you want to get hagrid on a page in your React website. Great! Inside secret: we love React too; we've built our app with React!
Quick summary before diving in, the key steps are
<script>
on your webpage<div>
with the className = "hagrid"
wherever you want to show the widget
Here is how to get there:
Get the code snippet from the hagrid setup instructions page: https://dashboard.hagrid.io/settings/setup-instructions It will look something like this, and it will be unique to your hagrid account.
Add it to the <head>
section of your index.html file. You can find index.html in the public folder of your code.
<div>
to your page, with className = "hagrid"
, where you would like to have the hagrid widgetThat's it! You now have the hagrid widget on your webpage.
If you have any questions, mail us at [email protected]
If you want to render the hagrid widget only in a component and not the entire website, create a <script>
tag for when the component mounts. Here is how:
useEffect()
hook for functional components (or add it to thecomponentDidMount()
method in a class component). You can find the website ID in the code snippet from the hagrid setup instructions page: https://dashboard.hagrid.io/settings/setup-instructions
hagrid
to the <div>
, wherever you would like to have the hagrid widget