本组件可用于代码差异的查看, 由于是 react 编写的,仅支持 react 版本
先支持两种使用方式:
- 本地文件引入
- github 线上 diff 地址引入
npm i react-code-differ
import{CodeDiff}from"react-code-differ";importdiffTextfrom'./diffText'exportconstMyComponent=(args)=>{return(<CodeDifftype={"local"}path={diffText}/>);};import{CodeDiff}from"react-code-differ";exportconstMyComponent=(args)=>{constpath="https://api.github.com/repos/rtfpessoa/diff2html/pulls/106"return(<CodeDifftype={"github"}path={path}/>);};
