diff --git a/src/App.jsx b/src/App.jsx
index 5772f98..e15052d 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -1,49 +1,27 @@
import styles from './styles/App.module.scss'
-import React from 'react'
+import React, { useState } from 'react'
-function Person({ name, age }) {
+function Parent() {
+ const [count,setCount] = useState(0);
+ //const handleCallback = () => setCount(count + 1)
+ const increment = React.useCallback(() => setCount(count + 1));
return (
-
-
Имя: {name}
-
Возраст: {age}
-
- )
+ <>
+ {count}
+
+ >
+ );
}
-function ProductCard({title, price, background}) {
- return (
-
-
{title}
-
Цена: {price}
-
- )
-}
+const Child = React.memo(({ onClick }) => {
+ console.log('child rendered');
+ return
+})
function App() {
- const [price1, setPrice1] = React.useState(1000);
- const [bgColor2, setBgColor2] = React.useState('#ffe6e6');
-
- const changePrice1 = () => setPrice1(cur => cur + 100);
- const changeBgColor2 = () => {
- const colors = ['#ffe6e6','#00e6e6','#ffefe6','#00f6f6'];
- const random = colors[Math.floor(Math.random() * colors.length)];
- setBgColor2(random);
- }
-
return (
<>
- Практика Props
-
-
-
-
+
>
)
}