Frontend óra (2024. 12. 10.)

This commit is contained in:
Tóth Ádám 2024-12-12 10:55:57 +01:00
parent 6656516036
commit 888977cca3
2 changed files with 14 additions and 13 deletions

View File

@ -1,15 +1,15 @@
import React from "react";
import { useState } from "react";
class Auto extends React.Component {
render() {
function Auto() {
let [szin, setSzin] = useState()
setSzin("szia")
return (
<>
<p>Autó</p>
<p>Piros</p>
<pre>Lada</pre>
<p>Autó tulajdonságok:</p>
<p>Az autó színe: {szin} </p>
</>
)
}
}
export default Auto

View File

@ -1,14 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
// import App from './App';
import Auto from "./Auto"
import reportWebVitals from './reportWebVitals';
let auto1 = {szin: "narancs", marka: "Suzuki"}
let auto2 = {szin: "vörös", marka: "Fiat"}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<Auto />
<Auto auto1={auto1} auto2={auto2}/>
</React.StrictMode>
);