VSCode ES7 React/Redux snippets Cheat Sheet
by frankieali4 via cheatography.com/76915/cs/18893/
Basic Methods React React (cont)
imp→ import moduleName from 'module' imr→ import React from 'react' cwun→ componentWillUnmount = () => { }
imn→ import 'module' imrd→ import ReactDOM from 'react-dom' gdsfp→ static
getDerivedStateFromProps(nextPro
imd→ import { destructuredModule } from imrc→ import React, { Component } from
'module' 'react' ps, prevState) { }
gsbu→ getSnapshotBeforeUpdate =
ime→ import * as alias from 'module' imrcp→ import React, { Component } from
(prevProps, prevState) => { }
'react' & import PropTypes from
ima→ import { originalName as
'prop-types' ren→ render() { return( ) }
aliasName} from 'module'
imrpc→ import React, { PureComponent } sst→ this.setState({ })
exp→ export default moduleName
from 'react'
ssf→ this.setState((state, props) =>
exd→ export { destructuredModule } from
imrpcp→ import React, { PureComponent } return { })
'module'
from 'react' & import PropTypes
props→ this.props.propName
exa→ export { originalName as
from 'prop-types'
aliasName} from 'module' state→ this.state.stateName
imrm→ import React, { memo } from 'react'
enf→ export const functionName = rcontext→ const ${1:contextName} =
(params) => { } imrmp→ import React, { memo } from 'react' React.createContext()
& import PropTypes from
edf→ export default (params) => { } cref→ this.${1:refName}Ref =
'prop-types'
React.createRef()
met→ methodName = (params) => { }
impt→ import PropTypes from
fref→ const ref = React.createRef()
fre→ arrayName.forEach(element => { } 'prop-types'
bnd→ this.methodName =
fof→ for(let itemName of objectName { } imrr→ import { BrowserRouter as Router,
this.methodName.bind(this)
fin→ for(let itemName in objectName { } Route, Link } from 'react-router-
dom'
anfn→ (params) => { } Redux
redux→ import { connect } from 'react-redux'
nfn→ const functionName = (params) => {
rconst→ constructor(props) with this.state rxaction→ redux action template
}
rconc→ constructor(props, context) with rxconst→ export const $1 = '$1'
dob→ const {propName} =
objectToDescruct this.state rxreducer→ redux reducer template
dar→ const [propName] = est→ this.state = { } rxselect→ redux selector template
arrayToDescruct cwm→ componentWillMount = () => { }
DEPRECATED!!! Console
sti→ setInterval(() => { }, intervalTime
sto→ setTimeout(() => { }, delayTime cdm→ componentDidMount = () => { } clg→ console.log(object)
prom→ return new Promise((resolve, reject) cwr→ componentWillReceiveProps = clo→ console.log("object", object)
=> { } (nextProps) => { }
ctm→ console.time("timeId")
DEPRECATED!!!
cmmb→ comment block cte→ console.timeEnd("timeId")
scu→ shouldComponentUpdate =
cp→ const { } = this.props cas→ console.assert(expression,object)
(nextProps, nextState) => { }
cs→ const { } = this.state ccl→ console.clear()
cwup→ componentWillUpdate =
(nextProps, nextState) => { } cco→ console.count(label)
Others
DEPRECATED!!!
cdi→ console.dir
cmmb→ comment block cdup→ componentDidUpdate = cer→ console.error(object)
(prevProps, prevState) => { }
cgr→ console.group(label)
cge→ console.groupEnd()
ctr→ console.trace(object)
cwa→ console.warn
cin→ console.info
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 Yours!
Page 1 of 2. https://apollopad.com
VSCode ES7 React/Redux snippets Cheat Sheet
by frankieali4 via cheatography.com/76915/cs/18893/
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 Yours!
Page 2 of 2. https://apollopad.com