PrimeReact using built in Charts and Google Charts together

PrimeReact using built in Charts and Google Charts together

Problem Description:

I’m using primereact and react-google-charts. However, they both want me to call the components as Charts. When I write a chart, I get an error. What solution should I follow?

(https://i.stack.imgur.com/4qGie.png)(https://i.stack.imgur.com/5dpNr.png)

I tried calling the components as chart VSCode gave an error. Then I tried as Gantt and got the above error

Solution – 1

you can use import aliases

import {Chart as GoogleChart} from 'react-google-charts';
import {Chart as PrimeChart} from 'primereact';

now use GoogleChart and PrimeChart wherever you want

<GoogleChart />
<PrimeChart />
Rate this post

PrimeReact using built in Charts and Google Charts together

PrimeReact using built in Charts and Google Charts together

Problem Description:

I’m using primereact and react-google-charts. However, they both want me to call the components as Charts. When I write a chart, I get an error. What solution should I follow?

(https://i.stack.imgur.com/4qGie.png)(https://i.stack.imgur.com/5dpNr.png)

I tried calling the components as chart VSCode gave an error. Then I tried as Gantt and got the above error

Solution – 1

you can use import aliases

import {Chart as GoogleChart} from 'react-google-charts';
import {Chart as PrimeChart} from 'primereact';

now use GoogleChart and PrimeChart wherever you want

<GoogleChart />
<PrimeChart />
Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject