1
- import React from " react" ;
2
- import PropTypes from " prop-types" ;
3
- import { diff , formatters } from " jsondiffpatch" ;
4
- import ReactHtmlParser from " react-html-parser" ;
1
+ import React from ' react' ;
2
+ import PropTypes from ' prop-types' ;
3
+ import { diff , formatters } from ' jsondiffpatch' ;
4
+ import ReactHtmlParser from ' react-html-parser' ;
5
5
6
- import { useStoreContext } from " ../store" ;
6
+ import { useStoreContext } from ' ../store' ;
7
7
8
8
function Diff ( { snapshot, show } ) {
9
9
const [ mainState ] = useStoreContext ( ) ;
10
- const { currentTab, tabs } = mainState ; //Nate:: k/v pairs of mainstate store object being created
10
+ const { currentTab, tabs } = mainState ; // Nate:: k/v pairs of mainstate store object being created
11
11
const { snapshots, viewIndex, sliderIndex } = tabs [ currentTab ] ;
12
12
let previous ;
13
13
@@ -17,17 +17,16 @@ function Diff({ snapshot, show }) {
17
17
} else {
18
18
previous = snapshots [ sliderIndex - 1 ] ;
19
19
}
20
- // Nate:: diff function from jsondiffpatch is supposed to return a comparaison of two objects, one has an updated change
20
+ // Nate:: diff function returns a comparaison of two objects, one has an updated change
21
21
const delta = diff ( previous , snapshot ) ;
22
22
// returns html in string
23
23
const html = formatters . html . format ( delta , previous ) ;
24
24
if ( show ) formatters . html . showUnchanged ( ) ;
25
25
else formatters . html . hideUnchanged ( ) ;
26
26
27
- if ( previous === undefined || delta === undefined )
28
- return (
29
- < div > No state change detected. Trigger an event to change state </ div >
30
- ) ;
27
+ if ( previous === undefined || delta === undefined ) {
28
+ return < div > No state change detected. Trigger an event to change state </ div > ;
29
+ }
31
30
return < div > { ReactHtmlParser ( html ) } </ div > ;
32
31
}
33
32
0 commit comments