cavaleria
cavaleria

Reputation: 1475

Import in Babel translation

In a module's documentation, it says I should import a component by:

var LineChart = require("react-chartjs").Line;

What would be the translation of this be using import in Babel? The .Line is the confusing part for me.

Upvotes: 0

Views: 258

Answers (2)

Bergi
Bergi

Reputation: 664620

You would write

import { Line as LineChart } from 'react-chartjs';

Upvotes: 1

Rob M.
Rob M.

Reputation: 36511

The Babel module import equivalent would be:

import { Line } from 'react-chartjs';

Upvotes: 3

Related Questions