Skip to content

Commit

Permalink
Added Clear All button functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Aayush259 committed Jun 22, 2024
1 parent f0d246a commit 7f2623c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/History.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export default function History() {
setUserHistory(updatedHistory);
};

// This function clears the complete history.
const clearHistory = () => {
setUserHistory([]);
}

return (
<>
<GoBackButton backURL={'/Find-GitHub-User/'} />
Expand Down Expand Up @@ -71,6 +76,7 @@ export default function History() {
hover:bg-sky-600
active:bg-sky-400
focus:outline-sky-400 focus:outline-4 focus:outline'
onClick={clearHistory}
>
Clear All
</button>
Expand Down

0 comments on commit 7f2623c

Please sign in to comment.