Installation
Learn how to install react-echarts-library in your React project
Prerequisites
Before installing react-echarts-library, make sure you have:
- Node.js 16.x or later
- React 16.x, 17.x, 18.x, or 19.x
- Apache ECharts 5.x or 6.x
- npm, yarn, or pnpm as your package manager
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:
- Control the exact version of ECharts in your project
- Take advantage of tree-shaking for smaller bundles
- Stay up-to-date with the latest ECharts features
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
- Quick Start Guide - Create your first chart
- API Reference - Explore the component API
- Examples - Browse chart examples