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

View File

@ -1,14 +1,15 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import './index.css'; import './index.css';
import App from './App'; // import App from './App';
import Auto from "./Auto" import Auto from "./Auto"
import reportWebVitals from './reportWebVitals'; 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')); const root = ReactDOM.createRoot(document.getElementById('root'));
root.render( root.render(
<React.StrictMode> <React.StrictMode>
<Auto /> <Auto auto1={auto1} auto2={auto2}/>
</React.StrictMode> </React.StrictMode>
); );