diff --git a/src/App.jsx b/src/App.jsx index 61f38a0..5772f98 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,4 +1,5 @@ import styles from './styles/App.module.scss' +import React from 'react' function Person({ name, age }) { return ( @@ -9,16 +10,40 @@ function Person({ name, age }) { ) } +function ProductCard({title, price, background}) { + return ( +
+

{title}

+

Цена: {price}

+
+ ) +} + function App() { - const options = {title:'Меню', width: 100, height: 200} - let {width, title, height} = options; - console.log(title); - console.log(width); - console.log(height); + 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

+ + + + ) }