Share a Recharts chart as a link
AI tools draw charts in React with Recharts. Wrap the component in one HTML file that loads React, Recharts and an in-browser JSX compiler, then upload it and send the link.
Ask Claude or ChatGPT for a dashboard or chart and you often get a React component that imports from "recharts". It renders in the chat preview. Saved as a .jsx file, it is source code: a browser shows the text or downloads it.
One HTML file can supply what the component needs: React, Recharts, a JSX compiler and an element to draw into. No npm, no bundler, no deploy.
The wrapper
Create chart.html. In the head, add an import map that tells the browser where each import lives:
- ✓<script type="importmap">{ "imports": { "react": "https://esm.sh/react@18.3.1", "react-dom": "https://esm.sh/react-dom@18.3.1", "react-dom/client": "https://esm.sh/react-dom@18.3.1/client", "recharts": "https://esm.sh/recharts@3.10.1?external=react,react-dom" } }</script>
- ✓Below it, Babel to compile JSX in the browser: <script src="https://unpkg.com/@babel/standalone@7.26.4/babel.min.js"></script>
- ✓In the body, <div id="root"></div>, then <script type="text/babel" data-type="module" data-presets="react"> containing the component code.
- ✓Keep import React from 'react' as the first line, add import { createRoot } from 'react-dom/client', and end with createRoot(document.getElementById('root')).render(<App />); using the component's name.
- ✓Tested in Chrome: a LineChart with two lines, axes, grid, tooltip and legend drew inside a ResponsiveContainer, and a button that switched it to a BarChart redrew it.
Blank page, error about useContext
Leave ?external=react,react-dom off the Recharts URL and esm.sh bundles its own copy of React into Recharts. Two copies of React on one page break hooks. The page stays empty and the console shows "Cannot read properties of null (reading 'useContext')". Add the suffix back so Recharts uses the React from your import map.
Blank page, no error
A ResponsiveContainer sizes the chart to its parent. If it has height="100%" and the parent has no height of its own, the container measures 0 pixels tall and nothing draws. The page shows only the elements around the chart, and the console stays quiet.
Give the container a fixed height, such as height={300}, or give its parent element a height. Chat previews often supply that height for you, which is why the same code looks fine there.
Upload it and send the link
Drag chart.html onto the FileShare Pro dashboard and copy the link. Viewers need no account, and the chart's tooltips work for them as they do for you.
Turn on comments and reviewers can pin notes to a point on the chart after typing a name. When the AI tool gives you a new version, paste it into the same wrapper and upload it over the old one; the link stays the same: updating a shared link without changing it.
Related: sharing a React component as a link, sharing a Claude artifact and, for a chart without React, sharing a Chart.js chart as a link.
Frequently asked
Yes. The numbers in the component are part of the HTML file. Nothing is fetched except React, Recharts and Babel from their CDNs.
The one the AI tool wrote for, when it says. The wrapper above was tested with Recharts 3.10.1 and React 18.3.1. Pin the version in the URL so the page does not change when a new release comes out.
Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.
Drop the file, copy the link — live in seconds, free plan included.
Start sharing free