1.0.0 • Published 5 years ago

react-text-diff v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

react-text-diff

A react component of diff text.

Install

npm install react-text-diff

Usage

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

class Demo extends Component{
    constructor(props) {
        super(props);
        this.state = {
            oldStr: oldStr,
            newStr: newStr,
            context: 100000, // max 100000
            outputFormat: 'side-by-side' //'line-by-line' or 'side-by-side'
        }
    }
    render(){
        return (
            <div>
                <CodeDiff oldStr={oldStr} newStr={newStr} context={context} outputFormat={outputFormat}/>;
            </div>
        )
    }
}

export default Demo;

Test Demo

git cloen xxx
npm i
npm run dev

demo