$ npm i -g @angular/cli
$ ng new my-first-app
$ npm start
import {
Component,
OnInit,
Input,
Output,
EventEmitter
} from '@angular/core';
import { Hero } from '@hero/models';
@Component({
selector: 'app-hero-detail',
templateUrl: './hero-detail.component.html',
styleUrls: ['./hero-detail.component.scss']
})
export class HeroDetailComponent implements OnInit {
@Input() hero: Hero;
@Output() expand = new EventEmitter();
constructor() { }
onExpand() {
this.expand.emit({});
}
ngOnInit() {
console.debug('ngOnInit hook');
}
}
this.sectionsSub = this.sections$
.pipe(
debounceTime(100),
map((sections) => {
return sections.map(s => s.section).join(',');
}),
distinct()
)
.subscribe(() => {
const scrollElement = document
.querySelector('.container__content');
if (scrollElement) {
scrollElement.scroll({
top: scrollElement.scrollHeight,
behavior: 'smooth'
});
}
});
}
$ npm i -g create-react-app
$ create-react-app my-first-app
$ npm start
class Board extends React.Component {
handleClick(i) {
const squares = this.state.squares.slice();
squares[i] = this.state.xIsNext ? 'X' : 'O';
this.setState({
squares: squares,
xIsNext: !this.state.xIsNext,
});
}
render() {
const winner = calculateWinner(this.state.squares);
const status = `Next player: ${ this.state.xIsNext ? 'X' : 'O') }`;
return (
<div>
<div className="status">{status}</div>
<div className="board-row">
{ this.renderSquare(0) }
{ this.renderSquare(1) }
{ this.renderSquare(2) }
</div>
</div>
);
}
}
- Solid conventions
- Your state is immutable
- Time travel
- It is light
- Pretty much backed by Facebook
- Dev tools
- Takes a while to learn and implement
- Lots of code
- No batching
- Thunks
- Refs are a pain to manage
- Just makes sense
- Less refactoring and boilerplate
- Open to any architecture
- No thunks or middlewares
- Your stores can be anything
- Open to interpretation
- The isArray (ObservableArray) pitfall
$ npm i -g @vue/cli
$ vue create my-first-app
$ npm run serve
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://github.com/vuejs/vue-cli/tree/dev/docs" target="_blank">
vue-cli documentation
</a>.
</p>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
</style>
👽