Skip to content

Commit 4b207dd

Browse files
committed
updated inital message in Diff.jsx
1 parent 4fd29a0 commit 4b207dd

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/app/components/Diff.jsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
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";
55

6-
import { useStoreContext } from '../store';
6+
import { useStoreContext } from "../store";
77

88
function Diff({ snapshot, show }) {
99
const [mainState] = useStoreContext();
10-
const { currentTab, tabs } = mainState;
10+
const { currentTab, tabs } = mainState; //k/v pairs of mainstate store object being created
11+
console.log(mainState);
1112
const { snapshots, viewIndex, sliderIndex } = tabs[currentTab];
1213
let previous;
1314

@@ -17,19 +18,17 @@ function Diff({ snapshot, show }) {
1718
} else {
1819
previous = snapshots[sliderIndex - 1];
1920
}
20-
21+
//diff function is supposed to return two of the same objects side by side
2122
const delta = diff(previous, snapshot);
23+
console.log("this is the result of running diff function ", delta);
2224
// returns html in string
2325
const html = formatters.html.format(delta, previous);
2426
if (show) formatters.html.showUnchanged();
2527
else formatters.html.hideUnchanged();
2628

27-
if (previous === undefined || delta === undefined) return <div> No state change detected. </div>;
28-
return (
29-
<div>
30-
{ReactHtmlParser(html)}
31-
</div>
32-
);
29+
if (previous === undefined || delta === undefined)
30+
return <div> No changes to State: trigger an event to update state </div>;
31+
return <div>{ReactHtmlParser(html)}</div>;
3332
}
3433

3534
Diff.propTypes = {

0 commit comments

Comments
 (0)