Skip to content

Commit 4c2351f

Browse files
committed
Add event target value source to test cases
1 parent 56bc60e commit 4c2351f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React, { useState } from 'react';
2+
3+
function MyFunctionalComponent({ props }) {
4+
const [count, setState] = useState({ count: 0 });
5+
6+
const handleClick = event => {
7+
setState({ count: event.target.value + 1 }); // Directly update the state
8+
console.log('Current input value:', count);
9+
};
10+
11+
return (
12+
<div>
13+
<input value={count.count} onChange={handleClick}></input>
14+
</div>
15+
);
16+
}

0 commit comments

Comments
 (0)