This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IAutomobile { | |
tires: Tire[], | |
engine: Engine | |
} | |
class Car implements IAutomobile { | |
constructor(public tires: Tire[], public engine: Engine) { } | |
} | |
class Tire { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.setState((state) => { | |
return { isTurnedOn: !state.isTurnedOn } | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
export default function Bulb({ lampState }) { | |
return lampState ? | |
(<span> | |
<img src={'https://cdn2.iconfinder.com/data/icons/flat-icons-19/512/Light_bulb.png'} width={50} /> | |
</span>) : | |
(<span> | |
<img src={'https://img.icons8.com/ios/1600/light-on.png'} width={50} /> | |
</span>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import Bulb from 'Bulb' | |
export default class Lamp extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
isTurnedOn : false | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import Lamp from 'Lamp' | |
class App extends React.Component { | |
render() { | |
return ( | |
<Lamp /> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lamp extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
isTurnedOn : false | |
} | |
} | |
switchLight = () => { | |
this.setState({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Club de Compras</title> | |
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">--> | |
</head> | |
<body> | |
<mat-toolbar color="default"> | |