Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React library to display unified diff between two strings [closed]

I am looking for a React component that shows a unified git-like diff between two strings (specifically, two different JSON snippets).

Like this: unified git diff example

I am currently using the react-ace diff component, but that only does a side-by-side comparison and also doesn't take into account what has been added or removed.

like image 617
Caledonia Thomson Avatar asked Aug 30 '26 21:08

Caledonia Thomson


1 Answers

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

like image 168
Jamil Mammri Avatar answered Sep 02 '26 11:09

Jamil Mammri