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
Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21
Windows 0 1 0 0 0 2 1 1 1 0 1 1 2 0 1 0 0 1 2 1 2 2 2 0 1 0 0 0 1 3 1 2 0 0 1 0 1 0 1 0 0 2 2 1 1 0
Mac 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 2 1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 2 0
Linux 0 1 2 0 0 0 0 0 1 1 1 0 1 1 1 0 0 2 1 0 0 0 1 0 0 2 0 2 0 0 0 1 1 0 0 1 0 1 1 1 1 0 0 1 0 1

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})