import * as React from 'react';
import { connect, DispatchProp } from 'react-redux';
import { connectedPropSelector } from './selectors';
interface OwnProps {
ownProp: string,
}
interface ConnectedProps {
connectedProp: string,
}
type Props = OwnProps & ConnectedProps & DispatchProp<any>;
interface State {
someKey: string,
}
class Example extends React.Component<Props, State> {
state = {
someKey: 'someValue',
};
render() {
const { ownProp, connectedProp } = this.props;
return ( /* ... */ );
}
}
const mapStateToProps = state => ({
connectedProp: connectedPropSelector(state),
});
export default connect(mapStateToProps)(Example);
<div class="grid">
<div>Ячейка</div>
<div>Ячейка</div>
...
<!-- Повторить max число колонок вмещающихся по ширине экрана -->
<div class="grid-clearfix"></div>
<div class="grid-clearfix"></div>
....
<div class="grid-clearfix"></div>
</div>
.grid {
display: flex;
flex-flow: row wrap;
align-items: flex-start;
}
.grid > div {
flex-grow: 1;
flex-basis: 270px;
box-sizing: border-box;
padding: 5px;
}
.grid .grid-clearfix {
opacity: 0;
height: 0px;
padding: 0;
overflow: hidden;
}
number.toString(2)
function dec2bin(dec) {
return (dec >>> 0).toString(2);
}