Skip to content

Commit

Permalink
Reset array when page changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Otanga-Otieno committed Mar 17, 2022
1 parent e8a6e3c commit 5cd73dc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions index/src/pages/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React from "react";
import {arr, originalArray, getArray, bubbleSort} from "./main.js";

function Bubble() {
let array = arr.slice();

return (
<div onLoad={() => {
originalArray(arr);
bubbleSort(arr);
originalArray(array);
bubbleSort(array);
}} style={{backgroundColor: "white", padding: "2.5%", margin: "2.5%"}}>
<link rel="stylesheet" href="main.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
5 changes: 3 additions & 2 deletions index/src/pages/Heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import {arr, originalArray, getArray, heapSort} from "./main.js";


function Heap() {
let array = arr.slice();

return (
<div onLoad={() => {
originalArray(arr);
heapSort(arr);
originalArray(array);
heapSort(array);
}} style={{backgroundColor: "white", padding: "2.5%", margin: "2.5%"}}>
<link rel="stylesheet" href="main.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
5 changes: 3 additions & 2 deletions index/src/pages/Insertion.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React from "react";
import {arr, originalArray, getArray, insertionSort} from "./main.js";

function Insertion() {
let array = arr.slice();

return (
<div onLoad={() => {
originalArray(arr);
insertionSort(arr);
originalArray(array);
insertionSort(array);
}} style={{backgroundColor: "white", padding: "2.5%", margin: "2.5%"}}>
<link rel="stylesheet" href="main.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
5 changes: 3 additions & 2 deletions index/src/pages/Quick.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React from "react";
import {arr, originalArray, getArray, quickSort} from "./main.js";

function Quick() {
let array = arr.slice();

return (
<div onLoad={() => {
originalArray(arr);
quickSort(arr);
originalArray(array);
quickSort(array);
}} style={{backgroundColor: "white", padding: "2.5%", margin: "2.5%"}}>
<link rel="stylesheet" href="main.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
5 changes: 3 additions & 2 deletions index/src/pages/Selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React from "react";
import {arr, originalArray, getArray, selectionSort} from "./main.js";

function Selection() {
let array = arr.slice();

return (
<div onLoad={() => {
originalArray(arr);
selectionSort(arr);
originalArray(array);
selectionSort(array);
}} style={{backgroundColor: "white", padding: "2.5%", margin: "2.5%"}}>
<link rel="stylesheet" href="main.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down

0 comments on commit 5cd73dc

Please sign in to comment.