Skip to content

Commit 3b0a99e

Browse files
added comments to the ComponentMap function defining custom hooks useForceUpdate function and map layout
1 parent 2ebd730 commit 3b0a99e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ export type LinkTypesProps = {
2222
};
2323

2424
export default function ComponentMap({
25-
// importing props
25+
// imported props to be used to display the dendrogram
2626
width: totalWidth,
2727
height: totalHeight,
2828
margin = defaultMargin,
2929
snapshots: snapshots,
3030
}: LinkTypesProps) {
31-
// preparing the data to be used for render
31+
// selecting the last element of the snapshots array object to meet the data structure of the visx map
3232
const lastNode = snapshots.length - 1;
3333
const data = snapshots[lastNode];
34+
// custom hooks to setup the entire map on the are prescribed for the map
3435
const [layout, setLayout] = useState<string>('cartesian');
3536
const [orientation, setOrientation] = useState<string>('horizontal');
3637
const [linkType, setLinkType] = useState<string>('diagonal');
3738
const [stepPercent, setStepPercent] = useState<number>(0.5);
39+
// Declared this variable and assigned it to the useForceUpdate function that forces a state to change causing that component to re-render and display on the map
3840
const forceUpdate = useForceUpdate();
3941
// setting the margins for the Map to render in the tab
4042
const innerWidth = totalWidth - margin.left - margin.right;

0 commit comments

Comments
 (0)