Skip to content

Instantly share code, notes, and snippets.

@seanmodd
Created January 31, 2022 21:37
Show Gist options
  • Save seanmodd/ff23ea0fda6f8c921e8909f0ec9697b6 to your computer and use it in GitHub Desktop.
Save seanmodd/ff23ea0fda6f8c921e8909f0ec9697b6 to your computer and use it in GitHub Desktop.

Functional Components

rsf - React Stateless Function

import React from 'react';

function BugsList(props) {
  return (
    <div>

    </div>
  );
}

export default BugsList;

rsc - React Stateless Component

import React from 'react';

const BugsList = () => {
  return (
    <div>

    </div>
  );
};

export default BugsList;

Console Logging

clst - Creates console.log with text

console.log('text', value);

Hooks

rush - Destructuring the useState statement

const [name, setName] = useState();

Object

objc - Creates const object with one name:value pair

const objName = {
  name: value
}

Functions

fp1 - Creates Default Function with 1 Param

function functionName(paramName){
 // do something
};

func - Creates Default Function

function functionName(){
 // do something
};

Conditional Statements

floop - Creates Default For Loop

for (let i = 0; i < something; i++){
  // do something
}

dwloop - Creates default do/while loop

do {
 // do something
}
while(condition);

wloop - Creates default while loop

while (i < something){
 // do something
}

swca - Creates Switch Case with 2 Cases

switch (expression){
 case value1:
   // do something
   break;
 case value2:
   // do something
   break;
 default:
   // do something
}

ifel - Creates if statement

if (condition){
 // if condition is TRUE do something
} else {
 // do something else
};

ifs - Creates if statement

if (condition){
 // if condition is TRUE do something
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment