🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

y-react-code-diff

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

y-react-code-diff

JSON&&字符串代码比较组件的react实现

1.0.4
latest
npm
Version published
Weekly downloads
1
-75%
Maintainers
1
Weekly downloads
 
Created
Source

react-code-diff

此组件是基于vue-code-diff实现的react版本代码对比展示工具。

代码对比展示demo

安装

npm install react-code-diff

使用

import {Component} from 'react';
import CodeDiff from 'react-vode-diff';

class Demo extends Component{
    constructor(props) {
        super(props);
        this.state = {
            oldStr: oldStr,
            newStr: newStr,
        }
    }
    render(){
        return (
            <div>
                <CodeDiff oldStr={oldStr} newStr={newStr}/>;
            </div>
        )
    }
}

export default Demo;

参数说明

参数说明类型可选值默认值
old-string陈旧的字符串string
new-string新的字符串string
context不同地方上下间隔多少行不隐藏number
outputFormat展示的方式stringline-by-line,side-by-sideline-by-line

效果展示

line-by-line

line-by-line

side-by-side

line-by-line

LICENSE

MIT

FAQs

Package last updated on 15 Jun 2020

Did you know?

Socket

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.

Install

Related posts