# react-markdown — card for AI agents

React component for rendering markdown with customizable component handling.

Category: Markdown, editors and content · npm package `react-markdown` · latest version 10.1.0 (checked 2026-11-01)
Install: `npm install react-markdown`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## react-markdown
- Import the default export (`import Markdown from 'react-markdown'`). The package is ESM only and needs Node.js 16+.
- Pass the markdown string as `children`. Never render markdown with `dangerouslySetInnerHTML`.
- For tables, strikethrough, tasklists or bare URLs, add `remark-gfm` to `remarkPlugins`. To pass plugin options, use `[[plugin, options]]`.
- Customize output through the `components` map (for example `code`, `a`, `h2`). Don't post-process the HTML.
- With async plugins, use `MarkdownAsync` on the server or `MarkdownHooks` on the client. Give `MarkdownHooks` a `fallback`.
- Use either `allowedElements` or `disallowedElements`, never both. Keep the default `urlTransform` unless you need different URL rules.
- When using `rehype-katex`, import `katex/dist/katex.min.css` yourself.

## What it is
- react-markdown is a React component. You give it a string of markdown and it renders React elements. The repository has existed since 2015 and is MIT licensed. The README says it is "safe by default", with no `dangerouslySetInnerHTML` or XSS attacks.
- It is built on unified. remark parses the markdown, and rehype handles the HTML side. Because the output is a virtual DOM built from a syntax tree, the README says "React only replaces what changed". You change behavior in two ways: remark and rehype plugins, and a `components` map that replaces tags like `h2` or `code` with your own components.
- The maintainers say the package "focusses on making it easy for beginners to safely use markdown in React." For people already familiar with unified, they point to `react-remark` or `rehype-react`. For JSX inside markdown files, they point to MDX.

## Caveats
- ESM only, Node 16+: There is no CommonJS build. The current line, `react-markdown@10`, targets Node.js 16. The README also says it works in modern browsers but not IE 11.
- Async plugins need a different component: The default `Markdown` export is synchronous. With async plugins, use `MarkdownAsync` on the server or `MarkdownHooks` on the client.
- MarkdownHooks renders nothing at first: `MarkdownHooks` relies on `useEffect` and `useState`, so output appears only after processing on the client. A `fallback` prop sets what shows in the meantime.
- Tables and tasklists are not built in: GFM features such as tables, strikethrough, tasklists and bare URLs require the `remark-gfm` plugin. Without it you get plain CommonMark.
- The syntax highlight example has a known ESM problem: A maintainer note above the `react-syntax-highlighter` example in the README flags it as broken under real ESM.

## Numbers (AgentGid data)
- Gid Score: 83.4 (#52 of all tools, 2 of 149 in its category)
- Used in 248 public projects set up for AI coding agents (4.0%)
- Downloads last week: 61,554,226 (as of 2026-11-24), +54.2% over 4 weeks
- GitHub stars: 15,944 (as of 2026-11-24)
- Last push: 2026-10-03

## Often used with
React 99.2%, Lucide React 77.0%, remark-gfm 66.5%, Tailwind Merge 67.3%, Tailwind CSS 87.9%, clsx 66.9%

## Checked alternatives (same job)
- Marked: https://agentgid.com/tools/marked/agent.md
- MDX: https://agentgid.com/tools/mdx-js/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/react-markdown/
- Homepage: https://github.com/remarkjs/react-markdown#readme
- Repository: https://github.com/remarkjs/react-markdown
- Source: https://github.com/remarkjs/react-markdown#readme
- Source: https://github.com/remarkjs/react-markdown
- Source: https://github.com/remarkjs/react-markdown/releases

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
