Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Step 01: Listening for selection change in a React component
Browse files Browse the repository at this point in the history
  • Loading branch information
colbyfayock committed Feb 11, 2024
1 parent 94902cf commit a506f3f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/SelectMenu.tsx
@@ -0,0 +1,13 @@
import { useEffect } from 'react';

const SelectMenu = () => {
useEffect(() => {
document.addEventListener('selectionchange', () => {
console.log('Selection Changed!')
});
}, []);

return null;
}

export default SelectMenu;
3 changes: 3 additions & 0 deletions src/pages/index.astro
@@ -1,9 +1,12 @@
---
import Layout from '@/layouts/Layout.astro';
import Container from '@/components/Container.astro';
import SelectMenu from '@/components/SelectMenu.tsx';
---
<Layout title="The Evolution of JavaScript">
<Container class="prose">
<SelectMenu client:load />

<h1>The Evolution of JavaScript: From Browser Scripting to Full-Stack Dominance</h1>

<p>By ChatGPT</p>
Expand Down

0 comments on commit a506f3f

Please sign in to comment.