yarn add eslint babel-eslint -D
./node_modules/.bin/eslint --init
import { createAction } from 'redux-actions'; | |
import { | |
NAVIGATION_PUSH, | |
NAVIGATION_POP, | |
NAVIGATION_RESET_TO, | |
NAVIGATION_POP_TO_ROOT | |
} from './actions'; | |
export const push = createAction(NAVIGATION_PUSH); | |
export const pop = createAction(NAVIGATION_POP); |
import React, { Component } from "react" | |
import { compose } from "recompose" | |
import { | |
withScriptjs, | |
withGoogleMap, | |
GoogleMap, | |
Marker, | |
InfoWindow | |
} from "react-google-maps" |
import { compose, withState, withProps } from 'recompose' | |
function HoCComponent ({a, b, c, setA, setB}) { | |
return ( | |
<div> | |
<span>A: {a}</span> | |
<button onClick={setA}>Update A</button> | |
<span>B: {b}</span> | |
<button onClick={setB}>Update B</button> | |
<span>C: {c}</span> |
import _ from "lodash"; | |
import { graphql } from "react-apollo"; | |
import { compose, setDisplayName, wrapDisplayName } from "recompose"; | |
const isServer = typeof window !== "object"; | |
const DEFAULT_OPTIONS = { | |
fetchPolicy: isServer ? "network-first" : "cache-and-network" | |
}; |
import { | |
StyleSheet, | |
View, | |
TouchableOpacity | |
} from 'react-native' | |
import { Icon } from 'react-native-elements' | |
import React, { Component } from 'react' | |
import PropTypes from 'prop-types' | |
import MapView, { PROVIDER_GOOGLE } from 'react-native-maps' | |
import styled from 'styled-components/native' |
import React from 'react' | |
import { compose } from 'recompose' | |
import { connect } from 'react-redux' | |
import { withRouter } from 'react-router' | |
import classes from './ConnectPage.local.css' | |
const ConnectPage = requirements => WrappedComponent => { | |
class ConnectedComponent extends React.Component { | |
state = { | |
fetching: false, |
// Tweet.js | |
import React from 'react'; | |
import { compose, flattenProp, onlyUpdateForKeys } from 'recompose'; | |
const enhance = compose( | |
flattenProp('tweet'), | |
flattenProp('user'), | |
onlyUpdateForKeys(['username', 'image', 'name', 'tweet']), | |
); |
// TweetBox.js | |
import React from 'react'; | |
import { compose, mapProps, flattenProp } from 'recompose'; | |
const enhance = compose( | |
mapProps(({ limit, message, ...rest }) => ({ | |
...rest, | |
limit, | |
message, | |
textRemaining: limit - message.length |