Advertisement
fakesamgregory

Next Functional Component

Apr 15th, 2024
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.54 KB | None | 0 0
  1. {
  2.     // Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
  3.     // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
  4.     // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
  5.     // used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
  6.     // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
  7.     // Placeholders with the same ids are connected.
  8.     "Next Functional Component": {
  9.         "scope": "javascript,typescript,jsx,tsx",
  10.         "prefix": "nfc",
  11.         "body": [
  12.             "const $1 = () => {",
  13.             "  return (",
  14.             "    <div>",
  15.             "      $2",
  16.             "    </div>",
  17.             "  );",
  18.             "};",
  19.             "",
  20.             "export default $1;"
  21.         ],
  22.         "description": "Create a new functional component"
  23.     },
  24.  
  25.     "Next Route Component": {
  26.         "scope": "javascript,typescript,jsx,tsx",
  27.         "prefix": "nrpc",
  28.         "body": [
  29.             "export async function $1(request) {",
  30.             "  // const { $2 } = await request.json();",
  31.             "",
  32.             "    if (!$2) {",
  33.             "        return Response.json({",
  34.             "      success: false,"
  35.             "      message: \"Missing required fields\",",
  36.             "        status: 400,",
  37.             "        });",
  38.             "    }",
  39.             "",
  40.             "  return Response.json({"
  41.             "      success: true,"
  42.             "      message: \"Route created successfully\",",
  43.             "    data: { someData: true },"
  44.             "      status: 200,"
  45.             "  });"
  46.             "}"
  47.         ],
  48.         "description": "Create a new route component"
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement