This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import _ from 'lodash'; | |
import { | |
withState, | |
compose, | |
lifecycle, | |
} from 'recompose'; | |
const withErrorCatch = ErrorComponent => compose( | |
withState('errorComponent', 'setErrorComponent', null), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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', | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
NewerOlder