1import React from 'react';
2
3const ExampleComponent = () => {
4
5 function sayHello(name) {
6 alert(`hello, ${name}`);
7 }
8
9 return (
10 <button onClick={() => sayHello('James')}>Greet</button>
11 );
12}
13
14export default ExampleComponent;
1import React from 'react';
2
3const ExampleComponent = () => {
4
5 function sayHello(name) {
6 alert(`hello, ${name}`);
7 }
8
9 return (
10 <button onClick={() => sayHello('James')}>Greet</button>
11 );