45 lines
795 B
JavaScript
45 lines
795 B
JavaScript
import React, { useState } from "react";
|
|
|
|
/*
|
|
class Auto extends React.Component {
|
|
constructor(props){
|
|
super(props);
|
|
}
|
|
|
|
render(){
|
|
return (
|
|
<>
|
|
<p>Az autó márkája: {this.props.auto.marka}</p>
|
|
<p>Az autó színe: {this.props.auto.szin}</p>
|
|
</>
|
|
)
|
|
}
|
|
}
|
|
*/
|
|
/*
|
|
function Auto(props){
|
|
return (
|
|
<>
|
|
<p>Az autó márkája: {this.props.auto.marka}</p>
|
|
<p>Az autó színe: {this.props.auto.szin}</p>
|
|
</>
|
|
)
|
|
|
|
}
|
|
*/
|
|
|
|
function Auto(props){
|
|
let [auto, setAuto] = useState(props.auto);
|
|
|
|
|
|
return (
|
|
<>
|
|
<p>Az autó márkája: {auto.marka}</p>
|
|
<p>Az autó színe: {auto.szin}</p>
|
|
</>
|
|
)
|
|
|
|
}
|
|
|
|
|
|
export default Auto; |