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

141
Views
Using older React version 15.4 - Using CreateRef

I'm working on an older version of React and the version is 15.4. This version doesn't support createRef()

I've code which works for React 16.8 or later but doesn't work for this version. getting an error which is

c.default.createRef is not a function

Here's my code whihc works for React 16.8 or later version

 import React, { Component } from 'react';
    const TrustBox = ({ trustBoxRef }) => (
      <div ref={trustBoxRef} className="trustpilot-widget">
        <a href="https://www.trustpilot.com/review/example.com" target="_blank" rel="noopener noreferrer">
        Trustpilot
        </a>
      </div>
    );
    class TrustBoxContainer extends Component {
      constructor(props) {
            super(props);
            this.trustBoxRef = React.createRef();
      }
      
    componentDidMount() {
            if (window.Trustpilot) {
            window.Trustpilot.loadFromElement(this.trustBoxRef.current, true);
            }
    }
      
    render() {
            return <TrustBox trustBoxRef={this.trustBoxRef} />;
      }
    
    }
    export default TrustBoxContainer;

I did a lot of research on how to get the older version to work but in vain. Can someone please help me ?

about 4 years ago · Juan Pablo Isaza
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!