Skip to content

Commit a6b8087

Browse files
committed
Click Events iamshaunjp#7
1 parent 9f8c4a8 commit a6b8087

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

react-practice/src/Home.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
import React from 'react'
22

33
const Home = () => {
4+
5+
const handleClick = (e) => {
6+
console.log('Hello world', e);
7+
8+
}
9+
const handleClickAgain = (name, e) => {
10+
console.log('Hello Again ' + name, e.target)
11+
12+
}
413
return (
514
<div className='home'>
615
<h2>Homepage</h2>
16+
<button onClick={handleClick}>Click me</button>
17+
<button onClick={(e)=> handleClickAgain('Filip', e)}>Click me again</button>
718
</div>
819
)
920
}
1021

11-
export default Home
22+
export default Home

react-practice/src/Navbar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const Navbar = () => {
77
<div className='links'>
88
<a href='/'>Home</a>
99
<a href='/create'>New Blog</a>
10+
1011
</div>
1112
</nav>
1213
)

0 commit comments

Comments
 (0)