Изучаем Props
This commit is contained in:
Generated
+830
-9
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -4,12 +4,13 @@
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"info": "^1.0.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
},
|
||||
@@ -22,6 +23,7 @@
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.19",
|
||||
"globals": "^16.0.0",
|
||||
"sass": "^1.99.0",
|
||||
"vite": "^6.3.5"
|
||||
}
|
||||
}
|
||||
|
||||
+17
-3
@@ -1,10 +1,24 @@
|
||||
// удаляем все, оставляя лишь пустую функцию App ниже
|
||||
import styles from './styles/App.module.scss'
|
||||
|
||||
function Person({ name, age }) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<p>Имя: {name}</p>
|
||||
<p>Возраст: {age}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function App() {
|
||||
const options = {title:'Меню', width: 100, height: 200}
|
||||
let {width, title, height} = options;
|
||||
console.log(title);
|
||||
console.log(width);
|
||||
console.log(height);
|
||||
return (
|
||||
<>
|
||||
{/* Добавьте тестовый контент для проверки */}
|
||||
<h1>Hello, React!</h1>
|
||||
<Person name="Alex" age={28} />
|
||||
<Person name="Bob" age={35} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user