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

  • 1.0.0
  • github.​com
  • github.​com
  • 3 months ago
  • 25 minutes ago
  • 11 years ago

Installs

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