[[oktatas:web:react|< React]] ====== React - Komponensek ====== * **Szerző:** Sallai András * Copyright (c) Sallai András, 2023 * Licenc: [[https://creativecommons.org/licenses/by-sa/4.0/|CC Attribution-Share Alike 4.0 International]] * Web: https://szit.hu ===== Projekt készítése ===== npx create-react-app app01 code app01 app01/ |-public/ |-src/ |-pages/ | |-Welcome.css | `-Welcome.js |-App.css |-App.js |-App.test.js |-index.css |-index.js |-logo.svg |-reportWebVitals.js |-setupTests.js |-.gitignore |-package-lock.json |-package.json `-README.md ===== Kezdőlap ===== import './App.css'; function App() { return (

Valami

); } export default App;
.App { text-align: center; } ===== Az Msg lap ===== import './Msg.css' export default function Msg(props) { return

Helló {props.name}

}
h1 { background-color: aqua; } ===== A lap használata ===== import Msg from './pages/Msg'; import './App.css'; function App() { return (

Valami

); } export default App;