
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-stylable-diff-common
Advanced tools
Output differences between two strings in a stylable form.
Based on react-diff. Uses the diff module
npm install react-stylable-diff
Pass text to compare as props.inputA and props.inputB:
import React, {Component} from 'react';
import Diff from 'react-stylable-diff';
class MyComponent extends Component {
render() {
return (
<Diff inputA="worst" inputB="blurst" />
);
}
}
You can also specify different values in props.type
to compare in different ways. Valid values are 'chars',
'words', 'sentences' and 'json':
import React, {Component} from 'react';
import Diff from 'react-stylable-diff';
class MyComponent extends Component {
render() {
return (
<Diff type="words"
inputA="It was the worst of times"
inputB="It was the blurst of times" />
);
}
}
Outputs standard <ins> and <del> tags so you will at least
have the browser default styling for these. On my browser they
appear crossed-out or underlined.
You will probably want to add your own styles to look all fancy.
The output is wrapped in a div with class 'Difference' so you can
attach all your style rules to that. You can override this class with
props.className if you like.
Here are some styles that might work:
.Difference {
font-family: monospace;
}
.Difference > del {
background-color: rgb(255, 224, 224);
text-decoration: none;
}
.Difference > ins {
background-color: rgb(201, 238, 211);
text-decoration: none;
}
import React, {Component} from 'react';
import Diff from 'react-stylable-diff';
class MyComponent extends Component {
render() {
return (
<Diff inputA="worst" inputB="blurst" type="chars" />
);
}
}
MIT
FAQs
CommonJS component based on react-stylable-diff
We found that react-stylable-diff-common demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.