Frontend óra (2024. 12. 10.)
This commit is contained in:
parent
6656516036
commit
888977cca3
|
@ -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
|
|
@ -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>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user