Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
embeded HTML doesn't show on react page

I am trying to ad some gofundme donation buttons on a react page but it doesn't even show on screen.

const Donation = () => {
    return (
        <div>
            <div className="gfm-embed" data-url="https://www.gofundme.com/f/theyre-the-real-victims/widget/large/"></div>
            <script defer src="https://www.gofundme.com/static/js/embed.js"></script>
        </div>
    )
}
    
export default Donation

I have neve done anything like this before. Any help will be appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

React uses innerHTML to add elements to the DOM. innerHTML disables execution of script tags.

HTML5 specifies that a tag inserted with innerHTML should not execute.

So, the recommended way to include script tags is via the useEffect hook

const Donation = () => {

  useEffect(() => {
    const script = document.createElement('script');

    script.src = "https://www.gofundme.com/static/js/embed.js";
    script.async = true;

    document.body.appendChild(script);

    return () => {
      document.body.removeChild(script);
    }
  }, []);

    
  return (
   <div>
     <div className="gfm-embed" data-url="https://www.gofundme.com/f/theyre-the-real-victims/widget/large/"></div>
   </div>
  )
};

export default Donation
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!