Skip to content

Import Chart from react-chartjs-2 invalid #633

@gravitymedianet

Description

@gravitymedianet

I am trying to extend Chart.js, when I use the sample code given in the readme, which says:

import { Chart } from 'react-chartjs-2';

componentWillMount() {
  Chart.pluginService.register({
    afterDraw: function (chart, easing) {
      // Plugin code.
    }
  });
}

I get the following error from VS Code:

Module '"react-chartjs-2"' has no exported member 'Chart'. Did you mean to use 'import Chart from "react-chartjs-2"' instead?

Using version "react-chartjs-2": "^2.11.1",

I ended up doing Import Chart from "chart.js";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions