Installation

Learn how to install react-echarts-library in your React project

Prerequisites

Before installing react-echarts-library, make sure you have:

Install via npm

npm install react-echarts-library echarts

Install via yarn

yarn add react-echarts-library echarts

Install via pnpm

pnpm add react-echarts-library echarts

Peer Dependencies

The library requires echarts as a peer dependency. This allows you to:

TypeScript Support

react-echarts-library includes TypeScript definitions out of the box. No additional @types packages are required.

import { EChartsReact } from 'react-echarts-library';
import type { EChartsOption } from 'echarts';

const option: EChartsOption = {
  // Full type support and autocompletion
};

Verify Installation

Create a simple chart to verify the installation:

import { EChartsReact } from 'react-echarts-library';

function App() {
  const option = {
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      data: [120, 200, 150, 80, 70],
      type: 'bar'
    }]
  };

  return <EChartsReact option={option} style={{ height: 400 }} />;
}

If you see a bar chart rendered, the installation was successful!

Next Steps