Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Component not found #130

Open
MrCookiez opened this issue Feb 24, 2023 · 1 comment
Open

Error: Component not found #130

MrCookiez opened this issue Feb 24, 2023 · 1 comment

Comments

@MrCookiez
Copy link

Error: Component not found

Description

Then using the chargebee-js-react-wrapper components there is an error occurred when filling the form fields.

Error message:
Screenshot 2023-02-24 at 17 41 36

Code implementation:

export const initChargebee = () => {
    window.Chargebee.init({
      site: xxx,
      publishableKey: xxx,
    });
};

import React, { useState, useEffect, useRef } from "react";
import { CardComponent, CardNumber, CardExpiry, CardCVV } from "@chargebee/chargebee-js-react-wrapper";

...

const CardFormComponent = () => {
  const cardRef = useRef();

 // ... initChargebee ...
  
  return (
    <form>
      <CardComponent ref={cardRef}
        styles={options.style}
        classes={options.classes}
        locale="en"
        placeholder={options.placeholder}
      >
        <div className="class1">
          <CardNumber />
        </div>

        <div className="class2">
          <div className="class1">
            <CardExpiry />
          </div>

          <div className="class1">
            <CardCVV />
          </div>
        </div>

        <button onClick={onSubmit}>
          Submit
        </button>
      </CardComponent>
    </form>
  )
}

...

@Dremora
Copy link

Dremora commented Jul 18, 2023

I also get the same issue. However, trying to debug this made me realise that the problem doesn't lie with this library or even Chargebee itself, but with trying to initialise it more than once.

Have a look for the following message in the console logs:

Chargebee.js has been already initialized

If you can see it, eliminating repetitive initialisations should fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants