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