Skip to content

Commit fd7bd16

Browse files
committed
Passing Custom Arguments to Event Functions
1 parent 5d28ea4 commit fd7bd16

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/App.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import TabButton from './components/TabButton';
55
import { CORE_CONCEPTS } from './data/core-concepts';
66

77
function App() {
8-
function handleSelect() {
9-
console.log('Tab selected');
8+
function handleSelect(selectedTab) {
9+
console.log(selectedTab);
1010
}
1111

1212
return (
@@ -29,10 +29,12 @@ function App() {
2929
<section id="examples">
3030
<h2>Examples</h2>
3131
<menu>
32-
<TabButton onSelect={handleSelect}>Components</TabButton>
33-
<TabButton onSelect={handleSelect}>Props</TabButton>
34-
<TabButton onSelect={handleSelect}>State</TabButton>
35-
<TabButton onSelect={handleSelect}>JSX</TabButton>
32+
<TabButton onSelect={() => handleSelect('components')}>
33+
Components
34+
</TabButton>
35+
<TabButton onSelect={() => handleSelect('jsx')}>JSX</TabButton>
36+
<TabButton onSelect={() => handleSelect('props')}>Props</TabButton>
37+
<TabButton onSelect={() => handleSelect('state')}>State</TabButton>
3638
</menu>
3739
Dynamic Content
3840
</section>

0 commit comments

Comments
 (0)