Guest User

Untitled

a guest
Oct 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. {
  2. "Import React": {
  3. "prefix": "imr",
  4. "body": ["import React from 'react'"],
  5. "description": "Import React"
  6. },
  7.  
  8. "Import PropTypes": {
  9. "prefix": "impt",
  10. "body": ["import PropTypes from 'prop-types'"],
  11. "description": "Import PropTypes"
  12. },
  13.  
  14. "Class Component": {
  15. "prefix": "cc",
  16. "body": [
  17. "class $1 extends React.Component {",
  18. "\tstate = {$2}",
  19. "",
  20. "\trender() { ",
  21. "\t\treturn ($0)",
  22. "\t}",
  23. "}",
  24. "",
  25. "export default $1",
  26. ""
  27. ],
  28. "description": "Class Component"
  29. },
  30.  
  31. "Class Component With Constructor": {
  32. "prefix": "ccc",
  33. "body": [
  34. "class $1 extends React.Component {",
  35. "\tconstructor(props) {",
  36. "\t\tsuper(props);",
  37. "\t\tthis.state = { $2 }",
  38. "\t}",
  39. "",
  40. "\trender() { ",
  41. "\t\treturn ($0);",
  42. "\t}",
  43. "}",
  44. "",
  45. "export default $1",
  46. ""
  47. ],
  48. "description": "Class Component With Constructor"
  49. },
  50.  
  51. "Stateless Function Component": {
  52. "prefix": "sfc",
  53. "body": [
  54. "const $1 = ($2) => (",
  55. "\t$0",
  56. ")",
  57. "",
  58. "export default $1",
  59. ""
  60. ],
  61. "description": "Stateless Function Component"
  62. },
  63.  
  64. "componentDidMount": {
  65. "prefix": "cdm",
  66. "body": ["componentDidMount() {", "\t$0", "}"],
  67. "description": "componentDidMount"
  68. },
  69.  
  70. "componentDidUpdate": {
  71. "prefix": "cdu",
  72. "body": ["componentDidUpdate(prevProps, prevState) {", "\t$0", "}"],
  73. "description": "componentDidUpdate"
  74. },
  75.  
  76. "componentWillUnmount": {
  77. "prefix": "cwun",
  78. "body": ["componentWillUnmount() {", "\t$0", "}"],
  79. "description": "componentWillUnmount"
  80. },
  81.  
  82. "componentDidCatch": {
  83. "prefix": "cdc",
  84. "body": ["componentDidCatch(error, info) {", "\t$0", "}"],
  85. "description": "componentDidCatch"
  86. },
  87.  
  88. "setState": {
  89. "prefix": "ss",
  90. "body": ["this.setState({ $1: $2 })"],
  91. "description": "setState"
  92. },
  93.  
  94. "Functional setState": {
  95. "prefix": "ssf",
  96. "body": ["this.setState(prevState => {", "\treturn { $1: prevState.$1 }", "})"],
  97. "description": "Functional setState"
  98. },
  99.  
  100. "render": {
  101. "prefix": "ren",
  102. "body": ["render() {", "\treturn (", "\t\t $0", "\t)", "}"],
  103. "description": "render"
  104. },
  105. }
Add Comment
Please, Sign In to add comment