1const Button = () => {
2 console.log("Button Rendered!");
3 window.alert("Button Rendered");
4 return <button onClick="">Press me</button>;
5};
6
7const TextInput = () => {
8 const [textInput, setTextInput] = useState("Hallo");
9 const onChangeInput = useCallback(
10 (e) => {
11 setTextInput(e.target.value);
12 },
13 [textInput]
14 );
15 return (
16 <input
17 type="text"
18 onChange={onChangeInput}
19 value={textInput}
20 />
21 );
22}
23
24
25export default function App() {
26 return (
27 <div>
28 <TextInput/>
29 <Button />
30 </div>
31 );
32}
33