VSCode ES7 React/Redux snippets Cheat Sheet
by frankieali4 via cheatography.com/76915/cs/18893/
Basic Methods Others React (cont)
imp→ import moduleName from cmmb→ comment block cwup→ componentWillUpdate =
'module' (nextProps, nextState) => { }
imn→ import 'module' React DEPRECATED!!!
imd→ import { destructuredModule } imr→ import React from 'react' cdup→ componentDidUpdate = (prevP‐
from 'module' rops, prevState) => { }
imrd→ import ReactDOM from 'react-
ime→ import * as alias from 'module' dom' cwun→ componentWillUnmount = () =>
{}
ima→ import { originalName as imrc→ import React, { Component }
aliasName} from 'module' from 'react' gdsfp→ static getDerivedStateFromPr‐
ops(nextProps, prevState) { }
exp→ export default moduleName imrcp→ import React, { Component }
from 'react' & import PropTypes gsbu→ getSnapshotBeforeUpdate =
exd→ export { destructuredModule }
from 'prop-types' (prevProps, prevState) => { }
from 'module'
imrpc→ import React, { PureComponent ren→ render() { return( ) }
exa→ export { originalName as
} from 'react' sst→ this.setState({ })
aliasName} from 'module'
imrpcp→ import React, { PureComponent ssf→ this.setState((state, props) =>
enf→ export const functionName =
} from 'react' & import return { })
(params) => { }
PropTypes from 'prop-types'
edf→ export default (params) => { } props→ this.props.propName
imrm→ import React, { memo } from
met→ methodName = (params) => { } state→ this.state.stateName
'react'
fre→ arrayName.forEach(element => { rcontext→ const ${1:contextName} =
imrmp→ import React, { memo } from
} React.createContext()
'react' & import PropTypes from
fof→ for(let itemName of objectName { cref→ this.${1:refName}Ref =
'prop-types'
} React.createRef()
impt→ import PropTypes from 'prop-‐
fin→ for(let itemName in objectName { fref→ const ref = React.createRef()
types'
} bnd→ this.methodName = this.meth‐
imrr→ import { BrowserRouter as
anfn→ (params) => { } odName.bind(this)
Router, Route, Link } from
nfn→ const functionName = (params) 'react-router-dom'
Redux
=> { } redux→ import { connect } from 'react-
rxaction→ redux action template
dob→ const {propName} = objectToD‐ redux'
escruct rxconst→ export const $1 = '$1'
rconst→ constructor(props) with this.state
dar→ const [propName] = arrayToDe‐ rxreducer→ redux reducer template
rconc→ constructor(props, context) with
scruct this.state rxselect→ redux selector template
sti→ setInterval(() => { }, intervalTime est→ this.state = { }
Console
sto→ setTimeout(() => { }, delayTime cwm→ componentWillMount = () => { }
prom→ return new Promise((resolve, DEPRECATED!!! clg→ console.log(object)
reject) => { } cdm→ componentDidMount = () => { } clo→ console.log("object", object)
cmmb→ comment block cwr→ componentWillReceiveProps = ctm→ console.time("timeId")
cp→ const { } = this.props (nextProps) => { } DEPREC‐ cte→ console.timeEnd("timeId")
cs→ const { } = this.state ATED!!! cas→ console.assert(expression,object)
scu→ shouldComponentUpdate = ccl→ console.clear()
(nextProps, nextState) => { }
cco→ console.count(label)
cdi→ console.dir
cer→ console.error(object)
By frankieali4 Published 19th February, 2019. Sponsored by ApolloPad.com
cheatography.com/frankieali4/ Last updated 19th February, 2019. Everyone has a novel in them. Finish
Page 1 of 2. Yours!
https://apollopad.com
VSCode ES7 React/Redux snippets Cheat Sheet
by frankieali4 via cheatography.com/76915/cs/18893/
Console (cont)
cgr→ console.group(label)
cge→ console.groupEnd()
ctr→ console.trace(object)
cwa→ console.warn
cin→ console.info
Component Templates
rfc react functional component
rfce react functional component
with last line export
rfcp react functional component
with PropTypes and last line
export
rcc react class component
rce react class component with last
line export
rccp react class component with
PropTypes and ES7 module
system
rcep react class component with
PropTypes and last line export
rcredux redux connected class
component with PropTypes
reduxmap mapping to props constants
rpc react pure component
rpcp react pure component with
PropTypes
rpce react pure component with
PropTypes and last line export
hoc react higher order component
with PropTypes
hocredux redux connected higher order
component with PropTypes
rafc react arrow function
component
By frankieali4 Published 19th February, 2019. Sponsored by ApolloPad.com
cheatography.com/frankieali4/ Last updated 19th February, 2019. Everyone has a novel in them. Finish
Page 2 of 2. Yours!
https://apollopad.com