This file contains hidden or 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 Header from "./Header"; | |
| import Footer from "./Footer" | |
| export default class Layout extends React.Component { | |
| render() { | |
| const services = [ | |
| { | |
| id: 1, |
This file contains hidden or 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
| const Services = () => ( | |
| <div> | |
| {services.map(service => ( | |
| <div className={service.class}> | |
| <p>{service.id}</p> | |
| <p>{service.name}</p> | |
| </div> | |
| ))} | |
| </div> | |
| ); |
This file contains hidden or 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
| export default class TodosList extends React.Component { | |
| renderItems() { | |
| return _.map(this.props.todos, (todo, index) => <TodosListItem key={index}{...todo} />) | |
| } | |
| render() { | |
| return ( | |
| <table> | |
| <TodosListHeader /> | |
| <tbody> |
This file contains hidden or 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 Child extends React.Component { | |
| render () { | |
| return (<div>I'm the child</div>); | |
| } | |
| } | |
| class ShowHide extends React.Component { | |
| constructor () { | |
| super (); | |
| this.state = { |
This file contains hidden or 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
| var TimerExample = React.createClass({ | |
| getInitialState: function () { | |
| return {elapsed: 0} | |
| }, | |
| componentDidMount: function () { | |
| this.timer = setInterval(this.tick, 50); | |
| }, |
This file contains hidden or 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
| <button onClick={this.props.greet}>Greet</button> |
This file contains hidden or 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
| angular.module('myModule', []); | |
| angular.module('myModule').controller('ControllerOne', ['$scope', function($scope) { | |
| }]); | |
| angular.module('myModule').controller('ControllerTwo', ['$scope', function ($scope) { | |
| }]) |
This file contains hidden or 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
| "scripts": { | |
| "clean": "rimraf dist", | |
| "build": "tsc", | |
| "watch:build": "tsc --watch", | |
| "watch:server": "nodemon './dist/index.js' --watch './dist'", | |
| "start": "npm-run-all clean build --parallel watch:build watch:server --print-label" | |
| }, |
This file contains hidden or 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 Subject { | |
| registerObserver(o: Observer): void; | |
| removeObserver(o: Observer): void; | |
| notifyObservers(): void; | |
| } | |
| interface Observer { | |
| update(temperature: number): void; | |
| } |