Guest User

Untitled

a guest
Apr 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. {
  2. // Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
  3. // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
  4. // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
  5. // same ids are connected.
  6. // Example:
  7. // "Print to console": {
  8. // "prefix": "log",
  9. // "body": [
  10. // "console.log('$1');",
  11. // "$2"
  12. // ],
  13. // "description": "Log output to console"
  14. // }
  15.  
  16. "Component": {
  17. "prefix": "!comp",
  18. "body": [
  19. "import React, { Component } from 'react';",
  20. "",
  21. "export default class $1 extends Component {",
  22. " render() {",
  23. " return (",
  24. " <div>$2</div>",
  25. " );",
  26. " }",
  27. "}",
  28. ""
  29. ]
  30. },
  31.  
  32. "ConnectedComponent": {
  33. "prefix": "!conn",
  34. "body": [
  35. "import React, { Component } from 'react';",
  36. "import { connect } from 'react-redux';",
  37. "",
  38. "export class $1 extends Component {",
  39. " render() {",
  40. " return (",
  41. " <div>$2</div>",
  42. " );",
  43. " }",
  44. "}",
  45. "",
  46. "function mapStateToProps(state) {",
  47. " const {$3} = state;",
  48. "",
  49. " return {$3};",
  50. "}",
  51. "",
  52. "export default connect(mapStateToProps)($1);",
  53. ""
  54. ]
  55. }
  56. }
Add Comment
Please, Sign In to add comment