<html>
<body>
<div class="wrapper">
<div class="content"></div>
<div class="footer"></div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
.wrapper {
display: flex;
flex-direction: column;
height: 100%;
}
.content {
flex: 1 0 auto;
}
.footer {
flex: 0 0 auto;
}
type IFooIndex = string & {_type?: 'foo'};
type IBarIndex = string & {_type?: 'bar'};
class Foo {
id: IFooIndex;
}
class Bar {
id: IBarIndex;
}
function findFoo(index: IFooIndex) {
// searching by IFooIndex
}
findFoo( new Bar().id );
e1 with { identifier = e2, ... }
e1.With(identifier2: e2, ...)
const Grid extends React.Component {
state = { itemsSize: 'sm' };
handleChangeSize = () => { /* some code */ };
render() {
const { itemSize } = this.state;
const { items } = this.props;
return (
<Wrapper>
<ControlPanel onChangeSize={this.handleChangeSize} />
{items.map(item => <Item key={item.id} size={this.state.itemSize} />)}
</Wrapper>
);
}
}
const min = s => +Math.min(...s.toString().split(''))
x
- свойство экземпляра, другой - статический геттер:class Base {
constructor() {
this.x = 3;
}
static get x() {
return 1.5;
}
}
function Base() {
this.x = 3;
}
Base.x = 1.5;
// или
function Base() {}
Base.prototype.x = 3;
Base.x = 1.5;
class Base {
x = 3;
static x = 1.5;
}