Skip to content

Instantly share code, notes, and snippets.

View mb8z's full-sized avatar
🎯
Focusing

mb8z mb8z

🎯
Focusing
  • Freelance
  • Warsaw, Poland
View GitHub Profile
import React from 'react';
import { injectIntl } from 'react-intl';
const withIntl = (WrappedComponent) => {
const Component = injectIntl((props) => {
const { intl } = props;
// For shorter syntax - similar to `react-i18n`
const t = (id, values) => intl.formatMessage({ id }, values);
return (
<WrappedComponent {...props} t={t} />
import React from 'react';
import _ from 'lodash';
import {
withState,
compose,
lifecycle,
} from 'recompose';
const withErrorCatch = ErrorComponent => compose(
withState('errorComponent', 'setErrorComponent', null),
// Example file showing how to structure file responsible for API connection (with the use of `axios` library)
import axios from 'axios';
export class Fetch {
static type = {
singular: 'singular',
list: 'list',
};
import _ from 'lodash';
const ourArray = [
{first_name: 'Marcin', last_name: 'Brukiewicz', age: 24},
{first_name: 'Marta', last_name: 'Brukiewicz', age: 24},
{first_name: 'Test', last_name: 'xyz', age: 56}
];
_.sortBy(ourArray, ['last_name', 'first_name']);
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { middleware as reduxPackMiddleware } from 'redux-pack';
import * as Cookies from 'js-cookie';
import nock from 'nock';
import httpAdapter from 'axios/lib/adapters/http';
import API from '../../services/api';
import { login } from '../authentication';