Cheatography
https://cheatography.com
A list of snippets from the Reactjs code snippets VSCode Extension
Component Creators
rcc→ |
class component skeleton |
rccp→ |
class component skeleton with prop types after the class |
rcjc→ |
class component skeleton without import and default export lines |
rcfc→ |
class component skeleton that contains all the lifecycle methods |
rsc→ |
stateless component skeleton |
rscp→ |
stateless component with prop types skeleton |
Component Class Attributes
con→ |
class default constructor with props |
conc→ |
class default constructor with props and context |
est→ |
empty state object |
cwm→ |
componentWillMount method |
cdm→ |
componentDidMount method |
cwr→ |
componentWillReceiveProps method |
scu→ |
shouldComponentUpdate method |
cwup→ |
componentWillUpdate method |
cdup→ |
componentDidUpdate method |
cwun→ |
componentWillUnmount method |
ren→ |
render method |
sst→ |
this.setState with object as parameter |
ssf→ |
this.setState with function as parameter |
bnd→ |
binds the this of method inside the constructor |
|
|
PropTypes
pta→ |
array |
ptar→ |
array.isRequired |
ptb→ |
bool |
ptbr→ |
bool.isRequired |
ptf→ |
func |
ptfr→ |
func.isRequired |
ptn→ |
number |
ptnr→ |
number.isRequired |
pto→ |
object |
ptor→ |
object.isRequired |
pts→ |
string |
ptsr→ |
string.isRequired |
ptnd→ |
node |
ptndr→ |
node.isRequired |
ptel→ |
element |
ptelr→ |
element.isRequired |
pti→ |
instanceOf(ClassName) |
ptir→ |
instanceOf(ClassName).isRequired |
pte→ |
oneOf(['This', 'That']) |
pter→ |
oneOf(['This', 'That']).isRequired |
ptet→ |
oneOfType([PropType.string, PropType.number]) |
ptetr→ |
oneOfType([PropType.string, PropType.number]).isRequired |
ptao→ |
arrayOf(PropTypes.number) |
ptaor→ |
arrayOf(PropTypes.number).isRequired |
ptoo→ |
objectOf(PropTypes.number) |
ptoor→ |
objectOf(PropTypes.number).isRequired |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets