How hustcc/echarts-for-react works
Project type and purpose
• This is an open-source React component library (“echarts-for-react”) that wraps Apache ECharts into a React API.
• Its goal is to let any React app render ECharts charts by simply importing a component and passing ECharts option objects.
File structure
• Top-level:
• src/ – library source (core.tsx, index.ts, helper/, types.ts)
• __tests__/ – Jest/TS tests for core logic and helpers
• docs/ – example markdown, docs site under .umirc.js (Umi config)
• .github/workflows/build.yml – CI pipeline (test, build, coverage)
• package.json, tsconfig.json – package metadata and TypeScript config
• README.md – usage, API, examples for v3/v4/v5 of ECharts, Next.js notes
• Patterns:
• src/index.ts exports high-level ReactECharts component
• src/core.tsx implements ReactEChartsCore, handling lifecycle, ECharts init/update/resize
• src/helper contains pure utilities (is-equal, is-function, pick, etc.)
• docs/examples/*.md define usage cases and drive the documentation site
• CI runs tests ▶ builds ▶ publishes docs to GH Pages and package to npm
README for additional insights
• Describes two entry points: ReactECharts (auto-import ECharts) and ReactEChartsCore (manual ECharts module registration)
• Highlights peer dependencies (react, echarts, optionally echarts-gl)
• Covers supported props (option, notMerge, lazyUpdate, theme, onEvents, opts, autoResize)
• Notes Next.js transpile requirements