Try either "react-diff-view" or "react-diff-viewer".

The "react-diff-viewer" is quite simple to use/implement while the "react-diff-view" offers some more advanced features.

It's up to you, here the links: https://www.npmjs.com/package/react-diff-viewer https://www.npmjs.com/package/react-diff-view

Answer from Jamil Mammri on Stack Overflow
🌐
npm
npmjs.com › package › react-diff-viewer-continued
react-diff-viewer-continued - npm
Continuation of a simple and beautiful text diff viewer component made with diff and React. Latest version: 4.2.0, last published: a day ago. Start using react-diff-viewer-continued in your project by running `npm i react-diff-viewer-continued`. ...
      » npm install react-diff-viewer-continued
    
🌐
GitHub
github.com › praneshr › react-diff-viewer
GitHub - praneshr/react-diff-viewer: A simple and beautiful text diff viewer component made with Diff and React.
Inspired from Github diff viewer, it includes features like split view, inline view, word diff, line highlight and more. It is highly customizable and it supports almost all languages.
Starred by 1.6K users
Forked by 309 users
Languages   TypeScript 96.3% | JavaScript 3.1% | Shell 0.6% | TypeScript 96.3% | JavaScript 3.1% | Shell 0.6%
🌐
GitHub
github.com › aeolun › react-diff-viewer-continued › issues
Issues · aeolun/react-diff-viewer-continued
A simple and beautiful text diff viewer component made with Diff and React. - Aeolun/react-diff-viewer-continued
Author   Aeolun
🌐
npm
npmjs.com › package › react-diff-viewer
react-diff-viewer - npm
May 22, 2020 - Inspired from Github diff viewer, it includes features like split view, inline view, word diff, line highlight and more. It is highly customizable and it supports almost all languages. ... resetCodeBlocks() - Resets the expanded code blocks to it's initial state. Return true on successful reset and false during unsuccessful reset. Syntax highlighting is a bit tricky when combined with diff. Here, React Diff Viewer provides a simple render prop API to handle syntax highlighting.
      » npm install react-diff-viewer
    
Published   May 22, 2020
Version   3.1.1
Author   Pranesh Ravi
🌐
CodeSandbox
codesandbox.io › examples › package › react-diff-viewer
react-diff-viewer examples - CodeSandbox
AboutA simple and beautiful text diff viewer component made with diff and React202,512Weekly Downloads
🌐
GitHub
github.com › praneshr › react-diff-viewer › tree › v2.0
GitHub - praneshr/react-diff-viewer at v2.0
Inspired from Github's diff viewer, it includes features like split view, inline view, word diff, line highlight and more. It is highly customizable and it supports almost all languages.
Starred by 1.6K users
Forked by 314 users
Languages   TypeScript 96.3% | JavaScript 3.1% | Shell 0.6% | TypeScript 96.3% | JavaScript 3.1% | Shell 0.6%
🌐
npm
npmjs.com › package › react-diff-view
react-diff-view - npm
July 24, 2025 - Add a react-diff-view/parse module providing 2 named exports: parseDiff and addStubHunk, this can be used on web workers.
      » npm install react-diff-view
    
Published   Jul 24, 2025
Version   3.3.2
Author   otakustay
Find elsewhere
🌐
CloudDefense.ai
clouddefense.ai › code › javascript › example › react-diff-view
Top 10 Examples of react-diff-view code in Javascript
2 : Number.MAX_SAFE_INTEGER; // react-diff-view, awesome as it is, does not accept unidiff format, you must add a git header section return `diff --git a/${i.name} b/${i.name} index 6829b8a2..4c565f1b 100644 ${formatLines(diffLines(i.a, i.b), {context, aname: `a/${name}}`, bname: `b/${i.name}`})}`; }) .join('\n'); // assume that if you only have one file, we don't need the file path const whiteBox = props.states.length > 1 ?
🌐
npm
npmjs.com › package › @alexbruf › react-diff-viewer
@alexbruf/react-diff-viewer - npm
April 30, 2025 - Inspired from Github diff viewer, it includes features like split view, inline view, word diff, line highlight and more. It is highly customizable and it supports almost all languages.
      » npm install @alexbruf/react-diff-viewer
    
Published   Apr 30, 2025
Version   3.1.5
Author   Alex Brufsky
🌐
CodeSandbox
codesandbox.io › s › react-diff-viewer-continued-demo-pjkx9q
react-diff-viewer-continued-DEMO - CodeSandbox
May 7, 2024 - react-diff-viewer-continued-DEMO by christ_cogni_con using antd, loader-utils, react, react-diff-view, react-diff-viewer-continued, react-dom, react-scripts
Published   Oct 06, 2023
Author   christ_cogni_con
🌐
GitHub
github.com › Aeolun › react-diff-viewer-continued
GitHub - Aeolun/react-diff-viewer-continued: A simple and beautiful text diff viewer component made with Diff and React. · GitHub
For example, [L-2, L-3, L-4, L-5] will highlight the lines 2-5 in the left pane. ... Shows only the diffed lines and folds the unchanged lines. ... Number of extra unchanged lines surrounding the diff. Works along with showDiffOnly. ... Render Prop API to render code fold message. (totalFoldedLines: number, leftStartLineNumber: number, rightStartLineNumber: number) => ReactElement...
Starred by 211 users
Forked by 51 users
Languages   HTML 76.3% | TypeScript 23.3%
🌐
GitHub
github.com › otakustay › react-diff-view
GitHub - otakustay/react-diff-view: A git diff component · GitHub
Add a react-diff-view/parse module providing 2 named exports: parseDiff and addStubHunk, this can be used on web workers.
Starred by 988 users
Forked by 89 users
Languages   TypeScript 92.9% | Less 3.7% | CSS 2.1% | JavaScript 1.1% | Shell 0.2%
🌐
DhiWise
dhiwise.com › post › exploring-the-power-of-react-diff-viewer-comprehensive-guide
Exploring the Benefits of React Diff Viewer for Code Comparison
February 15, 2024 - To enhance the user experience, React Diff Viewer allows developers to render code fold messages for expanded code blocks. This is particularly useful when dealing with large diffs where only a subset of changes is relevant to the user.
🌐
GitHub
github.com › udamir › api-diff-viewer
GitHub - udamir/api-diff-viewer: React component to view difference between two Json based API documents · GitHub
React component to view difference between two Json based API documents - udamir/api-diff-viewer
Starred by 45 users
Forked by 2 users
Languages   TypeScript 98.1% | CSS 1.8% | JavaScript 0.1%
🌐
GitHub
github.com › amplication › react-diff-viewer-continued
GitHub - amplication/react-diff-viewer-continued: A simple and beautiful text diff viewer component made with Diff and React. · GitHub
Most credit goes to Pranesh Ravi who created the original diff viewer. I've just made a few modifications and updated the dependencies so they work with modern stacks. yarn add react-diff-viewer-continued # or npm i react-diff-viewer-continued # or pnpm add react-diff-viewer-continued
Author   amplication
🌐
GitHub
github.com › MrWangJustToDo › git-diff-view
GitHub - MrWangJustToDo/git-diff-view: A Diff View component for React / Vue / Solid / Svelte / Ink, same as Github · GitHub
A Diff View component for React / Vue / Solid / Svelte / Ink, same as Github - MrWangJustToDo/git-diff-view
Starred by 662 users
Forked by 39 users
Languages   TypeScript 88.3% | Svelte 7.4% | JavaScript 2.1% | CSS 1.5%
🌐
Npm
npm.io › search › keyword:diff-viewer
Diff-viewer | npm.io
A simple and beautiful text diff viewer component made with diff and React · reviewcode-reviewdiffdiff-viewergithubreactreact-componentui1.0.2 • Published 6 years ago