Skip to content

Instantly share code, notes, and snippets.

View smashercosmo's full-sized avatar

Vladislav Shkodin smashercosmo

View GitHub Profile
// @flow
import React from 'react'
import { createSelector } from 'reselect'
import queryString from 'query-string'
import { type Location } from 'react-router-dom'
import Box from '../../components/Box/Box'
import {
OrganizationsContainer,
import React from 'react'
import {
SubComponent1,
SubComponent2,
SubComponent3,
} from '../SubComponents/SubComponents'
interface IComponentProps {
className?: string
const itemsByDate = items.reduce((acc, item) => {
const date = formatDate(new Date(item.datetime), token);
acc[date] = acc[date] ? acc[date].concat(item) : [item];
return acc;
}, {})
// можно как угодно отсортировать даты
const sortedDates = Object.keys(itemsByDate).sort()
const Items = sortedDates.reduce((acc, date) => {
import { Container } from 'unstated'
interface Organization {
id: string
}
interface OrganizationsState {
organizations: Organization[]
}
@smashercosmo
smashercosmo / Text.js
Last active June 6, 2018 14:36
shouldForwardProp
import styled from 'react-emotion'
import { string } from 'prop-types'
import isPropValid from '@emotion/is-prop-valid'
const color = props => {
if (props.color) return { color: props.color }
return null
}
export const TextProps = {
@smashercosmo
smashercosmo / Text.js
Created June 4, 2018 14:29
shouldForwardProp example
import styled from 'react-emotion'
import { bool } from 'prop-types'
import isPropValid from '@emotion/is-prop-valid'
import {
fontSize,
color,
textAlign,
fontWeight,
hover,
propTypes,