ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

React + Js Snippets

by HelloXiuXiu ALL

Sublime Text Snippets (JS, React and Redux)

Labels snippets, react, jsx, js

Details

Installs

  • Total 63K
  • Win 31K
  • Mac 22K
  • Linux 10K
Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12
Windows 1 0 2 1 2 1 1 1 3 0 0 2 1 0 2 1 2 0 1 0 0 0 0 0 0 0 1 1 2 2 2 1 4 3 2 1 3 5 1 4 1 0 0 0 1 1
Mac 0 0 0 1 1 1 0 0 1 0 1 0 0 0 0 2 1 0 3 0 1 2 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
Linux 1 1 1 2 0 1 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 2 0 1 2 2 0 1 1 0 0 0 0 1 1 0 1 0 2 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime Text Snippets (React + Redux and JS)!

To use a snippet type the shortcut and press Tab. Use Tab to change $1, $2, etc. statements one after another.

List of snippets:

React + Redux

rfc

import React from 'react'

export const ${1:${file_name}} = () => {
  return (
    ${2:<div>Hello</div>}
  )
}

st

const [${1:'kek'}, set${1:'Kek'}] = useState(${2:'kek'})

ef

useEffect(() => {
  ${1:// ...}
}, [])

rmap

{${1:data}.map((item, ind) => (
  ${2:<div key={ind\}>Kek</div>}
))}

rcmap

{${1:condition} && ${2:data}.map((item, ind) => (
  ${3:<div key={ind\}>Kek</div>}
))}

memo

const ${1:SomeComponent} = memo(function ${1:SomeComponent}({ prop }) {
  return (
    ${2:<div>Hello</div>}
  )
})

usememo

const ${1:variableName} = useMemo(() => {
  return ${2:null}
}, [])

usecall

const ${1:functionName} = useCallback(() => {
  ${2: // ...}
}, [])

sel

import { useSelector } from 'react-redux'

const ${1:kek} = useSelector((state) => state${2:kekSlice?.kek})

disp

import { useDispatch } from 'react-redux'

const dispatch = useDispatch()


JS

log

console.log(${1:'kek'})

if

if (${1:condition}) {
  ${2:// ...}
}

ife

if (${1:condition}) {
  ${2:// ...}
} else {
  ${3:// ...}
}

tr

${1:condition} ? ${2:expresion} : ${3:expresion}

for

for (let i = 0; i < ${1:10}; i++) {
  ${2:// ...}
}

fore

for (let i = 0; i < ${1:10}; i++) {
  ${2:// ...}
} else {
  ${3:// ...}
}

wh

while (${1:condition}) {
  ${1: // ...}
}

sw

switch(${1:expression}) {
  case 'x':
    {2: // ...}
    break;
  case 'y':
    {3: // ...}
    break;
  default:
    {4: // ...}
}

afn

() => {
  ${1:// ...}
}

ael

${1:window}.addEventListener(${2:'click'}), ${3:'handleClick'})

rel

${1:window}.removeEventListener(${2:'click'}), ${3:'handleClick'})

stm

setTimeout(() => {
  ${1:// ...}
}, ${2:1000})

sin

setInterval(() => {
  ${1:// ...}
}, ${2:1000})

keys

Object.keys(${1:obj}).forEach((key) {
  ${2:// ...}
})

rndmax

Math.floor(Math.random() * ${1:5})