192 | )
193 | }
194 |
195 | const mapStateToProps = (state) => ({})
196 |
197 | const mapDispatchToProps = {}
198 |
199 | \${FILE_NAME}.propTypes = {\${2:second}
200 | }
201 |
202 | export default connect(mapStateToProps, mapDispatchToProps)(\${FILE_NAME})`,type:"Components",description:"DEPRECATED: Creates a React functional component with PropTypes, connected redux and ES7 module system",fileTypes:["jsx","tsx"]},{prefix:"useEffectSnippet",snippet:`useEffect(() => {
203 | \${1:first}
204 | return () => {
205 | \${2:second}
206 | }
207 | }, [\${3:third}])
208 | `,type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useContextSnippet",snippet:"const ${1:first} = useContext(${2:second})",type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useStateSnippet",snippet:"const [${1:first}, set${1:first}] = useState(${2:second})",type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useReducerSnippet",snippet:"const [state, dispatch] = useReducer(${1:first}, ${2:second}, ${3:third})",type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useCallbackSnippet",snippet:`useCallback(
209 | () => {
210 | \${1:first}
211 | },
212 | [\${2:second}],
213 | )
214 | `,type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useMemoSnippet",snippet:"useMemo(() => ${1:first}, [${2:second}])",type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useRefSnippet",snippet:"const ${1:first} = useRef(${2:second})",type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useImperativeHandleSnippet",snippet:`useImperativeHandle(
215 | \${1:first},
216 | () => {
217 | \${2:second}
218 | },
219 | [\${3:third}],
220 | )
221 | `,type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"useLayoutEffectSnippet",snippet:`useLayoutEffect(() => {
222 | \${1:first}
223 |
224 | return () => {
225 | \${2:second}
226 | };
227 | }, [\${3:third}])
228 | `,type:"Hooks",fileTypes:["jsx","tsx"]},{prefix:"imr",snippet:"import React from 'react'",type:"ImportReact",fileTypes:["jsx","tsx"]},{prefix:"imrd",snippet:"import ReactDOM from 'react-dom'",type:"ImportReactDom",fileTypes:["jsx","tsx"]},{prefix:"imrc",snippet:"import React, { Component } from 'react'",type:"ImportReactWithComponent",fileTypes:["jsx","tsx"]},{prefix:"imrcp",snippet:`import React, { Component } from 'react'
229 | import PropTypes from 'prop-types'`,type:"ImportReactWithComponentAndPropTypes",fileTypes:["jsx","tsx"]},{prefix:"imrpc",snippet:"import React, { PureComponent } from 'react'",type:"ImportReactWithPureComponent",fileTypes:["jsx","tsx"]},{prefix:"imrpcp",snippet:`import React, { PureComponent } from 'react'
230 | import PropTypes from 'prop-types'`,type:"ImportReactWithPureComponent&PropTypes",fileTypes:["jsx","tsx"]},{prefix:"imrm",snippet:"import React, { memo } from 'react'",type:"ImportReactWithMemo",fileTypes:["jsx","tsx"]},{prefix:"imrmp",snippet:`import React, { memo } from 'react'
231 | import PropTypes from 'prop-types'`,type:"ImportReactWithMemo&PropTypes",fileTypes:["jsx","tsx"]},{prefix:"impt",snippet:"import PropTypes from 'prop-types'",type:"ImportPropTypes",fileTypes:["jsx","tsx"]},{prefix:"imbr",snippet:"import { BrowserRouter as Router } from 'react-router-dom'",type:"ReactRouter",fileTypes:["jsx","tsx"]},{prefix:"imrr",snippet:"import { BrowserRouter as Router, Route, NavLink } from 'react-router-dom'",type:"ReactRouterWithRouteAndNavLink",fileTypes:["jsx","tsx"]},{prefix:"imbrc",snippet:"import { Route, Switch, NavLink, Link } from 'react-router-dom'",type:"ImportRouterSetup",fileTypes:["jsx","tsx"]},{prefix:"imbrs",snippet:"import { Switch } from 'react-router-dom'",type:"ImportRouterSwitch",fileTypes:["jsx","tsx"]},{prefix:"imbrl",snippet:"import { Link } from 'react-router-dom'",type:"ImportRouterLink",fileTypes:["jsx","tsx"]},{prefix:"imbrnl",snippet:"import { NavLink } from 'react-router-dom'",type:"ImportRouterNavLink",fileTypes:["jsx","tsx"]},{prefix:"imp",snippet:"import ${2:Name} from '${1:first}'",type:"Import",fileTypes:["jsx","tsx"]},{prefix:"imn",snippet:"import '${1:first}'",type:"ImportNoModuleName",fileTypes:["jsx","tsx"]},{prefix:"imd",snippet:"import { ${2:Component} } from '${1:first}'",type:"ImportDestructing",fileTypes:["jsx","tsx"]},{prefix:"ime",snippet:"import * as ${2:comp} from '${1:first}'",type:"ImportEverything",fileTypes:["jsx","tsx"]},{prefix:"ima",snippet:"import { ${2:Component} as ${3:third} } from '${1:first}'",type:"ImportAs",fileTypes:["jsx","tsx"]},{prefix:"req",snippet:"const ${1:packageName} = require('${1:package}')",type:"RequireToConst",description:"Require a package to const",fileTypes:["tsx","javascript"]},{prefix:"exp",snippet:"export default ${1:first}",type:"ExportDefault",fileTypes:["jsx","tsx"]},{prefix:"exd",snippet:"export { ${2:second} } from '${1:first}'",type:"ExportDestructing",fileTypes:["jsx","tsx"]},{prefix:"exa",snippet:"export { ${2:second} as ${3:third} } from '${1:first}'",type:"ExportAs",fileTypes:["jsx","tsx"]},{prefix:"enf",snippet:"export const ${1:first} = (${2:second}) => {${3:third}}",type:"ExportNamedFunction",description:"Export named function",fileTypes:["jsx","tsx","javascript"]},{prefix:"edf",snippet:"export default (${1:first}) => {${2:second}}",type:"ExportDefaultFunction",description:"Export default function",fileTypes:["jsx","tsx"]},{prefix:"ednf",snippet:"export default function ${1:first}(${2:second}) {${3:third}}",type:"ExportDefaultNamedFunction",description:"Export default named function",fileTypes:["jsx","tsx","javascript"]},{prefix:"met",snippet:"${1:first} = (${2:second}) => {${3:third}}",type:"Method",description:"Creates a method inside a class",fileTypes:["jsx","tsx","javascript"]},{prefix:"pge",snippet:"get ${1:first}() {\n return this.${2:second}\n}",type:"PropertyGet",description:"Creates a getter property inside a class",fileTypes:["jsx","tsx","javascript"]},{prefix:"pse",snippet:"set ${1:first}(${2:second}) {${3:third}}",type:"PropertySet",description:"Creates a setter property inside a class",fileTypes:["jsx","tsx","javascript"]},{prefix:"fre",snippet:"${1:first}.forEach(${2:second} => {${3:third}})",type:"ForEach",description:"Creates a forEach statement",fileTypes:["jsx","tsx","javascript"]},{prefix:"fof",snippet:"for(let ${1:first} of ${2:second}) {${3:third}}",type:"ForOf",description:"Iterating over property names of iterable objects",fileTypes:["jsx","tsx","javascript"]},{prefix:"fin",snippet:"for(let ${1:first} in ${2:second}) {${3:third}}",type:"ForIn",description:"Iterating over property values of iterable objects",fileTypes:["jsx","tsx","javascript"]},{prefix:"anfn",snippet:"(${1:first}) => { ${2:second} }",type:"AnonymousFunction",description:"Creates an anonymous function",fileTypes:["jsx","tsx","javascript"]},{prefix:"nfn",snippet:"const ${1:first} = (${2:second}) => { ${3:third} }",type:"NamedFunction",description:"Creates a named function",fileTypes:["jsx","tsx","javascript"]},{prefix:"dob",snippet:"const {${2:second}} = ${1:first}",type:"DestructingObject",description:"Creates and assigns a local variable using object destructing",fileTypes:["jsx","tsx","javascript"]},{prefix:"dar",snippet:"const [${2:second}] = ${1:first}",type:"DestructingArray",description:"Creates and assigns a local variable using array destructing",fileTypes:["jsx","tsx","javascript"]},{prefix:"sti",snippet:"setInterval(() => { ${1:first} }, ${2:second})",type:"SetInterval",description:"Executes the given function at specified intervals",fileTypes:["jsx","tsx","javascript"]},{prefix:"sto",snippet:"setTimeout(() => { ${1:first} }, ${2:second})",type:"SetTimeOut",description:"Executes the given function after the specified delay",fileTypes:["jsx","tsx","javascript"]},{prefix:"prom",snippet:"return new Promise((resolve, reject) => { ${1:first} })",type:"Promise",description:"Creates and returns a new Promise in the standard ES7 syntax",fileTypes:["jsx","tsx","javascript"]},{prefix:"cp",snippet:"const { ${1:first} } = this.props",type:"DestructProps",description:"Creates and assigns a local variable using props destructing",fileTypes:["jsx","tsx"]},{prefix:"cs",snippet:"const { ${1:first} } = this.state",type:"DestructState",description:"Creates and assigns a local variable using state destructing",fileTypes:["jsx","tsx"]},{prefix:"rconst",snippet:`constructor(props) {
232 | super(props)
233 | this.state = {
234 | \${1:first}
235 | }
236 | }`,type:"ClassConstructor",description:"Adds a default constructor for it('', () => {})the class that contains props as arguments",fileTypes:["jsx","tsx"]},{prefix:"est",snippet:"state = { ${1:first} }",type:"EmptyState",description:"Creates empty state object. To be used in a constructor.",fileTypes:["jsx","tsx"]},{prefix:"cdm",snippet:"componentDidMount() { ${1:first} }",type:"ComponentDidMount",description:"Invoked once, only on the client (not on the server), immediately after the initial rendering occurs.",fileTypes:["jsx","tsx"]},{prefix:"scu",snippet:"shouldComponentUpdate(nextProps, nextState) { ${1:first} }",type:"ShouldComponentUpdate",description:"Invoked before rendering when new props or state are being received. ",fileTypes:["jsx","tsx"]},{prefix:"cdup",snippet:"componentDidUpdate(prevProps, prevState) { ${1:first}}",type:"ComponentDidUpdate",description:"Invoked immediately after the component's updates are flushed to the DOM.",fileTypes:["jsx","tsx"]},{prefix:"cwun",snippet:"componentWillUnmount() {${1:first} }",type:"ComponentWillUnmount",description:"Invoked immediately before a component is unmounted from the DOM.",fileTypes:["jsx","tsx"]},{prefix:"gdsfp",snippet:"static getDerivedStateFromProps(props, state) {${1:first}}",type:"GetDerivedStateFromProps",description:"Invoked right before calling the render method, both on the initial mount and on subsequent updates.",fileTypes:["jsx","tsx"]},{prefix:"gsbu",snippet:"getSnapshotBeforeUpdate = (prevProps, prevState) => {${1:first}}",type:"GetSnapshotBeforeUpdate",description:"Called right before mutations are made (e.g. before the DOM is updated)",fileTypes:["jsx","tsx"]},{prefix:"rcontext",snippet:"const ${1:first} = React.createContext()",type:"CreateContext",description:"Create React context",fileTypes:["jsx","tsx"]},{prefix:"cref",snippet:"this.${1:first}Ref = React.createRef()",type:"CreateRef",description:"Create ref statement used inside constructor",fileTypes:["jsx","tsx"]},{prefix:"sst",snippet:"this.setState((state, props) => { return { ${1:first} }})",type:"ComponentSetStateObject",description:"Performs a shallow merge of nextState into current state",fileTypes:["jsx","tsx"]},{prefix:"ssf",snippet:"this.setState((state, props) => { return { ${1:first} }})",type:"ComponentSetStateFunc",description:"Performs a shallow merge of nextState into current state",fileTypes:["jsx","tsx"]},{prefix:"props",snippet:"this.props.${1:first}",type:"ComponentProps",description:"Access component's props",fileTypes:["jsx","tsx"]},{prefix:"state",snippet:"this.state.${1:first}",type:"ComponentState",fileTypes:["jsx","tsx"]},{prefix:"bnd",snippet:"this.${1:first} = this.${1:first}.bind(this)",type:"BindThis",description:"Binds this to a method",fileTypes:["jsx","tsx"]},{prefix:"cmmb",snippet:`/**
237 | * \${1:first}
238 | */`,type:"CommentBigBlock",fileTypes:["jsx","tsx"]},{prefix:"hocredux",snippet:`import React from 'react'
239 | import { connect } from 'react-redux'
240 | import PropTypes from 'prop-types'
241 |
242 | export const mapStateToProps = state => ({})
243 |
244 | export const mapDispatchToProps = {}
245 |
246 | export const \${1:first} = (WrappedComponent) => {
247 | const hocComponent = ({ ...props }) =>
248 |
249 | hocComponent.propTypes = {}
250 |
251 | return hocComponent
252 | }
253 |
254 | export default WrapperComponent => connect(mapStateToProps, mapDispatchToProps)(\${1:first}(WrapperComponent))
255 | `,type:"HocComponentWithRedux",fileTypes:["jsx","tsx"]},{prefix:"hoc",snippet:`import React from 'react'
256 | import PropTypes from 'prop-types'
257 |
258 | export default (WrappedComponent) => {
259 | const hocComponent = ({ ...props }) =>
260 |
261 | hocComponent.propTypes = {}
262 |
263 | return hocComponent
264 | }
265 | `,type:"HocComponent",fileTypes:["jsx","tsx"]},{prefix:"tpf",snippet:"typeof ${1:first}",type:"TypeofSnippet",fileTypes:["jsx","tsx","javascript"]},{prefix:"call",snippet:"${1:method}.call(${2:context}, ${3:arguments})",type:"method",description:"Calls the function with the specified object as the this value and the specified rest arguments as the arguments.",fileTypes:["jsx","tsx","javascript"]},{prefix:"apply",snippet:"${1:method}.apply(${2:context}, ${3:arguments})",type:"method",description:"Calls the function with the specified object as the this value and the elements of specified array as the arguments.",fileTypes:["jsx","tsx","javascript"]},{prefix:"jp",snippet:"JSON.parse(${1:obj})",type:"JSON",description:"Converts a JavaScript Object Notation (JSON) string into an object",fileTypes:["jsx","tsx","javascript"]},{prefix:"js",snippet:"JSON.stringify(${1:obj})",type:"JSON",description:"Converts a JavaScript value to a JavaScript Object Notation (JSON) string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"us",snippet:"'use strict'",type:"use strict",description:"Use Javascript strict mode",fileTypes:["tsx","javascript"]},{prefix:"al",snippet:"alert('${1:message}')",type:"alert",fileTypes:["jsx","tsx","javascript"]},{prefix:"pr",snippet:"prompt('${1:message}')",type:"prompt",fileTypes:["jsx","tsx","javascript"]},{prefix:"cf",snippet:"confirm('${1:msg}');",type:"confirm",fileTypes:["jsx","tsx","javascript"]},{prefix:"cas",snippet:"console.assert(${1:first}, ${2:second})",type:"ConsoleAssert",description:"If the specified expression is false, the message is written to the console along with a stack trace",fileTypes:["jsx","tsx","javascript"]},{prefix:"ccl",snippet:"console.clear()",type:"ConsoleClear",description:"Clears the console",fileTypes:["jsx","tsx","javascript"]},{prefix:"cco",snippet:"console.count(${1:first})",type:"ConsoleCount",description:"Writes the the number of times that count() has been invoked at the same line and with the same label",fileTypes:["jsx","tsx","javascript"]},{prefix:"cdi",snippet:"console.dir(${1:first})",type:"ConsoleDir",description:"Prints a JavaScript representation of the specified object",fileTypes:["jsx","tsx","javascript"]},{prefix:"cer",snippet:"console.error(${1:first})",type:"ConsoleError",description:"Displays a message in the console and also includes a stack trace from where the method was called",fileTypes:["jsx","tsx","javascript"]},{prefix:"cgr",snippet:"console.group('${1:first}')",type:"ConsoleGroup",description:"Groups and indents all following output by an additional level, until console.groupEnd() is called.",fileTypes:["jsx","tsx","javascript"]},{prefix:"cge",snippet:"console.groupEnd()",type:"ConsoleGroupEnd",description:"Closes out the corresponding console.group().",fileTypes:["jsx","tsx","javascript"]},{prefix:"clg",snippet:"console.log(${1:first})",type:"ConsoleLog",description:"Displays a message in the console",fileTypes:["jsx","tsx","javascript"]},{prefix:"ctr",snippet:"console.trace(${1:first})",type:"ConsoleTrace",description:"Prints a stack trace from the point where the method was called",fileTypes:["jsx","tsx","javascript"]},{prefix:"clo",snippet:"console.log('${1:first}', ${2:second})",type:"ConsoleLogObject",description:"Logs property with name.",fileTypes:["jsx","tsx","javascript"]},{prefix:"clj",snippet:"console.log('${1:first}', JSON.stringify(${1:first}, null, 2))",type:"ConsoleLogJson",description:"Logs stringified JSON property with name.",fileTypes:["jsx","tsx","javascript"]},{prefix:"ctm",snippet:"console.time('${1:first}')",type:"ConsoleTime",description:"Console time wrapper",fileTypes:["jsx","tsx","javascript"]},{prefix:"cte",snippet:"console.timeEnd('${1:first}')",type:"ConsoleTimeEnd",description:"Console time end wrapper",fileTypes:["jsx","tsx","javascript"]},{prefix:"cwa",snippet:"console.warn(${1:first})",type:"ConsoleWarn",description:"Displays a message in the console but also displays a yellow warning icon along with the logged message",fileTypes:["jsx","tsx","javascript"]},{prefix:"cin",snippet:"console.info(${1:first})",type:"ConsoleInfo",description:"Displays a message in the console but also displays a blue information icon along with the logged message",fileTypes:["jsx","tsx","javascript"]},{prefix:"ctl",snippet:"console.table([${1:first}])",type:"ConsoleTable",description:"Logs table to console",fileTypes:["jsx","tsx","javascript"]},{prefix:"pta",snippet:"PropTypes.array",type:"PropTypeArray",description:"Array prop type",fileTypes:["jsx","tsx"]},{prefix:"ptar",snippet:"PropTypes.array.isRequired",type:"PropTypeArrayRequired",description:"Array prop type required",fileTypes:["jsx","tsx"]},{prefix:"ptb",snippet:"PropTypes.bool",type:"PropTypeBool",description:"Bool prop type",fileTypes:["jsx","tsx"]},{prefix:"ptbr",snippet:"PropTypes.bool.isRequired",type:"PropTypeBoolRequired",description:"Bool prop type required",fileTypes:["jsx","tsx"]},{prefix:"ptf",snippet:"PropTypes.func",type:"PropTypeFunc",description:"Func prop type",fileTypes:["jsx","tsx"]},{prefix:"ptfr",snippet:"PropTypes.func.isRequired",type:"PropTypeFuncRequired",description:"Func prop type required",fileTypes:["jsx","tsx"]},{prefix:"ptn",snippet:"PropTypes.number",type:"PropTypeNumber",description:"Number prop type",fileTypes:["jsx","tsx"]},{prefix:"ptnr",snippet:"PropTypes.number.isRequired",type:"PropTypeNumberRequired",description:"Number prop type required",fileTypes:["jsx","tsx"]},{prefix:"pto",snippet:"PropTypes.object",type:"PropTypeObject",description:"Object prop type",fileTypes:["jsx","tsx"]},{prefix:"ptor",snippet:"PropTypes.object.isRequired",type:"PropTypeObjectRequired",description:"Object prop type required",fileTypes:["jsx","tsx"]},{prefix:"pts",snippet:"PropTypes.string",type:"PropTypeString",description:"String prop type",fileTypes:["jsx","tsx"]},{prefix:"ptsr",snippet:"PropTypes.string.isRequired",type:"PropTypeStringRequired",description:"String prop type required",fileTypes:["jsx","tsx"]},{prefix:"ptnd",snippet:"PropTypes.node",type:"PropTypeNode",description:"Anything that can be rendered: numbers, strings, elements or an array",fileTypes:["jsx","tsx"]},{prefix:"ptndr",snippet:"PropTypes.node.isRequired",type:"PropTypeNodeRequired",description:"Anything that can be rendered: numbers, strings, elements or an array required",fileTypes:["jsx","tsx"]},{prefix:"ptel",snippet:"PropTypes.element",type:"PropTypeElement",description:"React element prop type",fileTypes:["jsx","tsx"]},{prefix:"ptelr",snippet:"PropTypes.element.isRequired",type:"PropTypeElementRequired",description:"React element prop type required",fileTypes:["jsx","tsx"]},{prefix:"pti",snippet:"PropTypes.instanceOf(${1:ClassName})",type:"PropTypeInstanceOf",description:"Is an instance of a class prop type",fileTypes:["jsx","tsx"]},{prefix:"ptir",snippet:"PropTypes.instanceOf(${1:ClassName}).isRequired",type:"PropTypeInstanceOfRequired",description:"Is an instance of a class prop type required",fileTypes:["jsx","tsx"]},{prefix:"pte",snippet:"PropTypes.oneOf(['${1:value1}', '${2:value2}'])",type:"PropTypeEnum",description:"Prop type limited to specific values by treating it as an enum",fileTypes:["jsx","tsx"]},{prefix:"pter",snippet:"PropTypes.oneOf(['${1:value1}', '${2:value2}']).isRequired",type:"PropTypeEnumRequired",description:"Prop type limited to specific values by treating it as an enum required",fileTypes:["jsx","tsx"]},{prefix:"ptet",snippet:`PropTypes.oneOfType([
266 | \${1:PropTypes.string},
267 | \${2:PropTypes.number},
268 | \${3:PropTypes.bool}
269 | ])`,type:"PropTypeOneOfType",description:"An object that could be one of many types",fileTypes:["jsx","tsx"]},{prefix:"ptetr",snippet:`PropTypes.oneOfType([
270 | \${1:PropTypes.string},
271 | \${2:PropTypes.number},
272 | \${3:PropTypes.bool}
273 | ]).isRequired`,type:"PropTypeOneOfTypeRequired",description:"An object that could be one of many types required",fileTypes:["jsx","tsx"]},{prefix:"ptao",snippet:"PropTypes.arrayOf(${1:PropTypes.string})",type:"PropTypeArrayOf",description:"An array of a certain type",fileTypes:["jsx","tsx"]},{prefix:"ptaor",snippet:"PropTypes.arrayOf(${1:PropTypes.string}).isRequired",type:"PropTypeArrayOfRequired",description:"An array of a certain type required",fileTypes:["jsx","tsx"]},{prefix:"ptoo",snippet:"PropTypes.objectOf(${1:PropTypes.number})",type:"PropTypeObjectOf",description:"An object with property values of a certain type",fileTypes:["jsx","tsx"]},{prefix:"ptoor",snippet:"PropTypes.objectOf(${1:PropTypes.number}).isRequired",type:"PropTypeObjectOfRequired",description:"An object with property values of a certain type required",fileTypes:["jsx","tsx"]},{prefix:"ptsh",snippet:"PropTypes.shape({\n ${1:propertyName}: ${2:PropTypes.string},\n ${3:propertyName2}: ${4:PropTypes.number}\n})",type:"PropTypeShape",description:"An object taking on a particular shape",fileTypes:["jsx","tsx"]},{prefix:"ptshr",snippet:"PropTypes.shape({\n ${1:propertyName}: ${2:PropTypes.string},\n ${3:propertyName2}: ${4:PropTypes.number}\n}).isRequired",type:"PropTypeShapeRequired",description:"An object taking on a particular shape required",fileTypes:["jsx","tsx"]},{prefix:"ptex",snippet:"PropTypes.exact({\n ${1:propertyName}: ${2:PropTypes.string},\n ${3:propertyName2}: ${4:PropTypes.number}\n})",type:"PropTypeExact",description:"An object with warnings on extra properties",fileTypes:["jsx","tsx"]},{prefix:"ptexr",snippet:"PropTypes.exact({\n ${1:propertyName}: ${2:PropTypes.string},\n ${3:propertyName2}: ${4:PropTypes.number}\n}).isRequired",type:"PropTypeExactRequired",description:"An object with warnings on extra properties required",fileTypes:["jsx","tsx"]},{prefix:"ptany",snippet:"PropTypes.any",type:"PropTypeAny",description:"Any prop type",fileTypes:["jsx","tsx"]},{prefix:"desc",snippet:"describe('${1:first}', () => { ${2:second} })",type:"describeBlock",description:"Testing `describe` block",fileTypes:["jsx","tsx"]},{prefix:"test",snippet:"test('should ${1:first}', () => { ${2:second} })",type:"TestBlock",description:"Testing `test` block",fileTypes:["jsx","tsx"]},{prefix:"testa",snippet:"test('should ${1:first}', async () => { ${2:second} })",type:"TestAsyncBlock",description:"Testing `asynchronous test` block",fileTypes:["jsx","tsx"]},{prefix:"tit",snippet:"it('should ${1:first}', () => { ${2:second} })",type:"ItBlock",description:"Testing `it` block",fileTypes:["jsx","tsx"]},{prefix:"tita",snippet:"it('should ${1:first}', async () => { ${2:second} })",type:"ItAsyncBlock",description:"Testing asynchronous `it` block",fileTypes:["jsx","tsx"]},{prefix:"stest",snippet:`import React from 'react'
274 | import renderer from 'react-test-renderer'
275 |
276 | import { \${1:\${FILE_NAME}} } from '../\${1:\${FILE_NAME}}'
277 |
278 | describe('<\${1:\${FILE_NAME}} />', () => {
279 | const defaultProps = {}
280 | const wrapper = renderer.create(<\${1:\${FILE_NAME}} {...defaultProps} />)
281 |
282 | test('render', () => {
283 | expect(wrapper).toMatchSnapshot()
284 | })
285 | })`,type:"SetupReactTest",fileTypes:["jsx","tsx"]},{prefix:"sntest",snippet:`import 'react-native'
286 | import React from 'react'
287 | import renderer from 'react-test-renderer'
288 |
289 | import \${1:\${FILE_NAME}} from '../\${1:\${FILE_NAME}}'
290 |
291 | describe('<\${1:\${FILE_NAME}} />', () => {
292 | const defaultProps = {}
293 | const wrapper = renderer.create(<\${1:\${FILE_NAME}} {...defaultProps} />)
294 |
295 | test('render', () => {
296 | expect(wrapper).toMatchSnapshot()
297 | })
298 | })`,type:"SetupReactNativeTest",fileTypes:["jsx","tsx"]},{prefix:"srtest",snippet:`import React from 'react'
299 | import renderer from 'react-test-renderer'
300 | import { Provider } from 'react-redux'
301 |
302 | import store from '~/store'
303 | import { \${1:\${FILE_NAME}} } from '../\${1:\${FILE_NAME}}'
304 |
305 | describe('<\${1:\${FILE_NAME}} />', () => {
306 | const defaultProps = {}
307 | const wrapper = renderer.create(
308 |
309 | <\${1:\${FILE_NAME}} {...defaultProps} />
310 | ,
311 | )
312 |
313 | test('render', () => {
314 | expect(wrapper).toMatchSnapshot()
315 | })
316 | })`,type:"SetupReactComponentTestWithRedux",description:"Create test component",fileTypes:["jsx","tsx"]},{prefix:"snrtest",snippet:`import 'react-native'
317 | import React from 'react'
318 | import renderer from 'react-test-renderer'
319 | import { Provider } from 'react-redux'
320 |
321 | import store from '~/store'
322 | import \${1:\${FILE_NAME}} from '../\${1:\${FILE_NAME}}'
323 |
324 | describe('<\${1:\${FILE_NAME}} />', () => {
325 | const defaultProps = {}
326 | const wrapper = renderer.create(
327 |
328 | <\${1:\${FILE_NAME}} {...defaultProps} />
329 | ,
330 | )
331 |
332 | test('render', () => {
333 | expect(wrapper).toMatchSnapshot()
334 | })
335 | })`,type:"SetupReactNativeTestWithRedux",fileTypes:["jsx","tsx"]},{prefix:"redux",snippet:"import { connect } from 'react-redux'",description:"Redux: Import connect from react-redux",type:"importReduxConnect",fileTypes:["jsx","tsx"]},{prefix:"rxaction",snippet:`export const \${1} = (payload) => ({
336 | type: \${2},
337 | payload
338 | })
339 | `,description:"Redux: Create a Redux action",type:"reduxAction",fileTypes:["jsx","tsx"]},{prefix:"rxconst",snippet:"export const ${1} = '${1}'",description:"Redux: Create a Redux constant",type:"reduxConst",fileTypes:["jsx","tsx"]},{prefix:"rxreducer",snippet:`const initialState = {}
340 |
341 | export default (state = initialState, { type, payload }) => {
342 | switch (type) {
343 | case \${1}:
344 | return { ...state, ...payload }
345 | default:
346 | return state
347 | }
348 | }
349 | `,description:"Redux: Create a Redux reducer",type:"reduxReducer",fileTypes:["jsx","tsx"]},{prefix:"rxselect",snippet:"import { createSelector } from 'reselect'\n\nexport const ${1} = state => state.${2}",description:"Redux: Create a Redux selector using Reselect",type:"reduxSelector",fileTypes:["jsx","tsx"]},{prefix:"rxslice",snippet:`import { createSlice } from '@reduxjs/toolkit'
350 |
351 | const initialState = {}
352 |
353 | const \${FILE_NAME} = createSlice({
354 | name: \${2},
355 | initialState,
356 | reducers: {}
357 | });
358 |
359 | export const {} = \${Placeholders.FILE_NAME}.actions
360 |
361 | export default \${Placeholders.FILE_NAME}.reducer`,description:"Redux: Create a Redux slice using @reduxjs/toolkit",type:"reduxSlice",fileTypes:["jsx","tsx"]},{prefix:"reduxmap",snippet:`const mapStateToProps = (state) => ({})
362 |
363 | const mapDispatchToProps = {}`,description:"Redux: Map state and dispatch to props",type:"mappingToProps",fileTypes:["jsx","tsx"]},{prefix:"exptp",snippet:"export type ${1:first} = {${2:second}}",type:"ExportType",fileTypes:["jsx","tsx"]},{prefix:"expint",snippet:"export interface ${1:first} {${2:second}}",type:"ExportInterface",fileTypes:["jsx","tsx"]},{prefix:"tsrcc",snippet:`import React, { Component } from 'react'
364 |
365 | interface Props {
366 | // Define your props here
367 | }
368 |
369 | interface State {
370 | // Define your state here
371 | }
372 |
373 | export default class \${1:\${FILE_NAME}} extends Component {
374 | state = {}
375 |
376 | render() {
377 | return (
378 |
379 | \${2:/* Your JSX code here */}
380 |
381 | )
382 | }
383 | }`,type:"TypescriptReactClassComponent",description:"Creates a React component class with ES7 module system and TypeScript interfaces",fileTypes:["jsx","tsx"]},{prefix:"tsrce",snippet:`import React, { Component } from 'react'
384 |
385 | interface Props {
386 | // Define your props here
387 | }
388 |
389 | interface State {
390 | // Define your state here
391 | }
392 | class \${1:\${FILE_NAME}} extends Component {
393 | state = {}
394 |
395 | render() {
396 | return (
397 |
398 | \${2:/* Your JSX code here */}
399 |
400 | )
401 | }
402 | }
403 |
404 | export default \${1:\${FILE_NAME}};`,type:"typescriptReactClassExportComponent",description:"Creates a React component class with ES7 module system and TypeScript interfaces",fileTypes:["jsx","tsx"]},{prefix:"tsrfce",snippet:`import React from 'react'
405 |
406 | interface Props {
407 | // Define your props here
408 | }
409 |
410 | function \${1:\${FILE_NAME}}({}: Props) {
411 | return (
412 |
413 | \${2:/* Your JSX code here */}
414 |
415 | )
416 | }
417 |
418 | export default \${1:\${FILE_NAME}};`,type:"typescriptReactFunctionalExportComponent",description:"Creates a React Functional Component with ES7 module system and TypeScript interface",fileTypes:["jsx","tsx"]},{prefix:"tsrfc",snippet:`import React from 'react'
419 |
420 | interface Props {
421 | // Define your props here
422 | }
423 |
424 | export default function \${1:\${FILE_NAME}}({}: Props) {
425 | return (
426 |
427 | \${2:/* Your JSX code here */}
428 |
429 | )
430 | }`,type:"typescriptReactFunctionalComponent",description:"Creates a React Functional Component with ES7 module system and TypeScript interface",fileTypes:["jsx","tsx"]},{prefix:"tsrafce",snippet:`import React from 'react';
431 |
432 | interface Props {
433 | // Define your props here
434 | }
435 |
436 | const \${1:\${FILE_NAME}} = (props: Props) => {
437 | return (
438 |
439 | \${2:first} {/* Your JSX code here */}
440 |
441 | );
442 | };
443 |
444 | export default \${1:\${FILE_NAME}};`,type:"typescriptReactArrowFunctionExportComponent",description:"Creates a React Arrow Function Component with ES7 module system and TypeScript interface",fileTypes:["jsx","tsx"]},{prefix:"tsrafc",snippet:`import React from 'react';
445 |
446 | interface Props {
447 | // Define your props here
448 | }
449 |
450 | const \${1:\${FILE_NAME}} = (props: Props) => {
451 | return (
452 |
453 | \${2:FirstTab} {/* Your JSX code here */}
454 |
455 | );
456 | };`,type:"typescriptReactArrowFunctionComponent",description:"Creates a React Arrow Function Component with ES7 module system and TypeScript interface",fileTypes:["jsx","tsx"]},{prefix:"tsrpc",snippet:`import React, { PureComponent } from 'react';
457 |
458 | interface Props {
459 | // Define your props here
460 | }
461 |
462 | export default class \${1:\${FILE_NAME}} extends PureComponent {
463 | \${2:innerComponentReturn}
464 | }`,type:"typescriptReactClassPureComponent",description:"Creates a React pure component class with ES7 module system and TypeScript interface",fileTypes:["jsx","tsx"]},{prefix:"tsrpce",snippet:`import React, { PureComponent } from 'react';
465 |
466 | interface Props {
467 | // Define your props here
468 | }
469 |
470 | class \${1:\${FILE_NAME}} extends PureComponent {
471 | \${2:innerComponentReturn}
472 | }
473 | export default \${1:\${FILE_NAME}};`,type:"typescriptReactClassExportPureComponent",description:"Creates a React pure component class with ES7 module system and TypeScript interface",fileTypes:["jsx","tsx"]},{prefix:"tsrcredux",snippet:`import { connect } from 'react-redux';
474 | \${1:reactComponent}
475 |
476 | interface Props {
477 | // Define your props here
478 | }
479 |
480 | interface State {
481 | // Define your state here
482 | }
483 |
484 | export class \${2:\${FILE_NAME}} extends Component {
485 | state = {};
486 | \${3:innerComponentReturn}
487 | }
488 | \${4:reduxComponentExport}`,type:"typescriptReactClassComponentRedux",description:"Creates a React component class with connected redux and ES7 module system and TypeScript interfaces",fileTypes:["jsx","tsx"]},{prefix:"tsrnf",snippet:`import { View, Text } from 'react-native';
489 | \${1:react}
490 |
491 | interface Props {
492 | // Define your props here
493 | }
494 |
495 | const \${2:\${FILE_NAME}} = (props: Props) => {
496 | return (
497 |
498 | \${3:FirstTab}
499 |
500 | );
501 | };
502 |
503 | export default \${2:\${FILE_NAME}};`,type:"typescriptReactNativeArrowFunctionComponent",description:"Creates a React Native Arrow Function Component with ES7 module system in TypeScript",fileTypes:["jsx","tsx"]},{prefix:"tsrnfs",snippet:`import { StyleSheet, Text, View } from 'react-native';
504 | \${1:react}
505 |
506 | interface Props {
507 | // Define your props here
508 | }
509 |
510 | const \${2:\${FILE_NAME}} = (props: Props) => {
511 | return (
512 |
513 | \${3:FirstTab}
514 |
515 | );
516 | };
517 |
518 | export default \${2:\${FILE_NAME}};
519 |
520 | const styles = StyleSheet.create({});`,type:"typescriptReactNativeArrowFunctionComponentWithStyles",description:"Creates a React Native Arrow Function Component with ES7 module system, TypeScript interface and StyleSheet",fileTypes:["jsx","tsx"]},{prefix:"fil",snippet:"${1:array}.filter((${2:element}) => ${3:condition})",type:"Array.filter",description:"Creates a new array with elements that pass a test.",fileTypes:["jsx","tsx","javascript"]},{prefix:"fi",snippet:"${1:array}.find((${2:element}) => ${3:condition})",type:"Array.find",description:"Returns the first element that passes a test.",fileTypes:["jsx","tsx","javascript"]},{prefix:"join",snippet:"${1:array}.join(${2:separator})",type:"Array.join",description:"Joins all elements of an array into a string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"map",snippet:"${1:array}.map((${2:element}, ${3:index}) => ${4:newElements})",type:"Array.map",description:"Creates a new array with the results of calling a function for each element.",fileTypes:["jsx","tsx","javascript"]},{prefix:"pop",snippet:"${1:array}.pop(${2:element})",type:"Array.pop",description:"Removes the last element from an array and returns it.",fileTypes:["jsx","tsx","javascript"]},{prefix:"push",snippet:"${1:array}.push(${2:element})",type:"Array.push",description:"Adds one or more elements to the end of an array.",fileTypes:["jsx","tsx","javascript"]},{prefix:"red",snippet:"${1:array}.reduce((${2:accumulator}, ${3:currentValue}) => ${4:accumulatorFunction}, ${5:initialValue})",type:"Array.reduce",description:"Combines all elements of an array into a single value.",fileTypes:["jsx","tsx","javascript"]},{prefix:"rev",snippet:"${1:array}.reverse()",type:"Array.reverse",description:"Reverses the order of the elements in an array.",fileTypes:["jsx","tsx","javascript"]},{prefix:"sh",snippet:"${1:array}.shift(${2:element})",type:"Array.shift",description:"Removes the first element from an array and returns it.",fileTypes:["jsx","tsx","javascript"]},{prefix:"unsh",snippet:"${1:array}.unshift(${2:element})",type:"Array.unshift",description:"Adds the specified element to the beginning of an array.",fileTypes:["jsx","tsx","javascript"]},{prefix:"spl",snippet:"${1:array}.splice(${2:start}, ${3:deleteCount}, ${4:elements})",type:"Array.splice",description:"Removes, replaces and/or adds new elements in an array.",fileTypes:["jsx","tsx","javascript"]},{prefix:"some",snippet:"${1:array}.some((${2:el}) => ${3:condition})",type:"Array.some",description:"Checks if at least one element in the array passes a test.",fileTypes:["jsx","tsx","javascript"]},{prefix:"sort",snippet:"${1:array}.sort((${2:a}, ${3:b}) => ${4:comparisonFunction})",type:"Array.sort",description:"Sorts the elements of an array in a particular order.",fileTypes:["jsx","tsx","javascript"]},{prefix:"tostr",snippet:"${1:array}.toString()",type:"Array.toString",description:"Returns a string representation of the array.",fileTypes:["jsx","tsx","javascript"]},{prefix:"frm",snippet:"Array.from(${1:arrayLike})",type:"Array.from",description:"Creates a new array from an iterable object.",fileTypes:["jsx","tsx","javascript"]},{prefix:"ca",snippet:"${1:str}.charAt(${2:index})",type:"String.charAt",description:"Returns the character at a specific index.",fileTypes:["jsx","tsx","javascript"]},{prefix:"match",snippet:"${1:str}.match(${2:regex})",type:"String.match",description:"Searches a string for a match against a regular expression.",fileTypes:["jsx","tsx","javascript"]},{prefix:"rpt",snippet:"${1:str}.repeat(${2:count})",type:"String.repeat",description:"Repeats a string a specified number of times.",fileTypes:["jsx","tsx","javascript"]},{prefix:"rep",snippet:"${1:str}.replace(${2:substring}, ${3:replacement})",type:"String.replace",description:"Searches a string for a match against a regular expression and replaces it with another string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"repa",snippet:"${1:str}.replaceAll(${2:substring}, ${3:replacement})",type:"String.replaceAll",description:"Searches a string for a all matches against a regular expression or a substring and replaces them with another string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"sw",snippet:"${1:str}.startsWith(${2:substr})",type:"String.startsWith",description:"Checks if a string starts with a specified substring.",fileTypes:["jsx","tsx","javascript"]},{prefix:"ew",snippet:"${1:str}.endsWith(${2:substr})",type:"String.endsWith",description:"Checks if a string ends with a specified substring.",fileTypes:["jsx","tsx","javascript"]},{prefix:"sstr",snippet:"${1:str}.substring(${2:start}, ${3:end})",type:"String.substring",description:"Extracts a substring from a string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"ss",snippet:"${1:str}.substr(${2:start}, ${3:length})",type:"String.substr",description:"Extracts a substring with a specific length from a string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"tlc",snippet:"${1:str}.toLowerCase()",type:"String.toLowerCase",description:"Returns a new string with all characters converted to lowercase.",fileTypes:["jsx","tsx","javascript"]},{prefix:"tuc",snippet:"${1:str}.toUpperCase()",type:"String.toUpperCase",description:"Returns a new string with all characters converted to uppercase.",fileTypes:["jsx","tsx","javascript"]},{prefix:"trm",snippet:"${1:str}.trim()",type:"String.trim",description:"Removes leading and trailing whitespace from a string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"sp",snippet:"${1:str}.split(${2:delimiter})",type:"String.split",description:"Splits a string into an array of substrings using all occurrences of the delimiter.",fileTypes:["jsx","tsx","javascript"]},{prefix:"inc",snippet:"${1:elements}.includes(${2:element}, ${3:start})",type:"includes",description:"Checks if an array or string includes a specific element",fileTypes:["jsx","tsx","javascript"]},{prefix:"sl",snippet:"${1:elements}.slice(${2:start}, ${3:end})",type:"slice",description:"Returns a shallow copy of selected elements in an array or string, as a new array or string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"io",snippet:"${1:elements}.indexOf(${2:element})",type:"indexOf",description:"Returns the first index of a specific element.",fileTypes:["jsx","tsx","javascript"]},{prefix:"cc",snippet:"${1:elements}.concat(${2:otherElements})",type:"concat",description:"Combines multiple strings or arrays into a single new string or array.",fileTypes:["jsx","tsx","javascript"]},{prefix:"lio",snippet:"${1:str}.lastIndexOf(${2:substr})",type:"lastIndexOf",description:"Returns the last index of a specified value within another array or string.",fileTypes:["jsx","tsx","javascript"]},{prefix:"ael",snippet:"${1:document}.addEventListener('${2:click}', ${3:(e) => {}})",type:"addEventListener",description:"Adds an event listener to a DOM element",fileTypes:["tsx","javascript"]},{prefix:"rel",snippet:"${1:document}.removeEventListener('${2:click}', ${3:eventListener})",type:"removeEventListener",description:"Removes an event listener from a DOM element",fileTypes:["tsx","javascript"]},{prefix:"ac",snippet:"${1:document}.appendChild(${2:elem})",type:"appendChild",description:"Adds a child node to a specified parent",fileTypes:["tsx","javascript"]},{prefix:"rc",snippet:"${1:document}.removeChild(${2:elem})",type:"removeChild",description:"Removes a child node from the DOM",fileTypes:["tsx","javascript"]},{prefix:"rpc",snippet:"${1:document}.replaceChild(${2:newChild}, ${3:oldChild})",type:"replaceChild",description:"Replaces a child node from the DOM",fileTypes:["tsx","javascript"]},{prefix:"inb",snippet:"${1:parentEl}.insertBefore(${2:newEl}, ${3:refEl})",type:"insertBefore",description:"Inserts a child node into the DOM",fileTypes:["tsx","javascript"]},{prefix:"ina",snippet:"${1:parentEl}.insertAdjacentHTML(${2:position}, ${3:el})",type:"insertAdjacentHTML",description:"Inserts a child node into the DOM",fileTypes:["tsx","javascript"]},{prefix:"ds",snippet:"${1:el}.dataset",type:"dataset",description:"Returns the value of all 'data-' properties on a HTML element",fileTypes:["tsx","javascript"]},{prefix:"gcs",snippet:"getComputedStyle(${1:el})",type:"replaceChild",description:"Removes a child node from the DOM",fileTypes:["tsx","javascript"]},{prefix:"cel",snippet:"${1:document}.createElement(${2:element})",type:"createElement",description:"Creates a new HTML element with a specified tag name",fileTypes:["tsx","javascript"]},{prefix:"cdf",snippet:"document.createDocumentFragment()",type:"createDocumentFragment",description:"Creates a new offscreen node",fileTypes:["tsx","javascript"]},{prefix:"cla",snippet:"${1:document}.classList.add('${2:class}')",type:"classList.add",description:"Adds a new CSS class to a HTML element",fileTypes:["tsx","javascript"]},{prefix:"clr",snippet:"${1:document}.classList.remove('${2:class}')",type:"classList.remove",description:"Removes an existing CSS class from a HTML element",fileTypes:["tsx","javascript"]},{prefix:"clt",snippet:"${1:document}.classList.toggle('${2:class}')",type:"classList.toggle",description:"Adds or removes a class based on wether it's already present",fileTypes:["tsx","javascript"]},{prefix:"gei",snippet:"${1:document}.getElementById('${2:id}')",type:"getElementById",description:"Returns an element whose id property matches the specified string",fileTypes:["tsx","javascript"]},{prefix:"gecn",snippet:"${1:document}.getElementsByClassName('${2:class}')",type:"getElementsByClassName",description:"Returns a HTML collection of elements with the given class name",fileTypes:["tsx","javascript"]},{prefix:"getn",snippet:"${1:document}.getElementsByTagName('${2:tag}')",type:"getElementsByTagName",description:"Returns a HTML collection of elements with the given tag name",fileTypes:["tsx","javascript"]},{prefix:"ga",snippet:"${1:document}.getAttribute('${2:attr}')",type:"getAttribute",description:"Returns the value of the specified attribute on the element",fileTypes:["tsx","javascript"]},{prefix:"sa",snippet:"${1:document}.setAttribute('${2:attr}')",type:"setAttribute",description:"Adds the attribute with the specified name on the element",fileTypes:["tsx","javascript"]},{prefix:"ra",snippet:"${1:document}.removeAttribute('${2:attr}')",type:"removeAttribute",description:"Removes the attribute with the specified name on the element",fileTypes:["tsx","javascript"]},{prefix:"ih",snippet:"${1:document}.innerHTML = '${2:elem}'",type:"innerHTML",description:"Gets or sets the HTML markup contained within an element",fileTypes:["tsx","javascript"]},{prefix:"tc",snippet:"${1:document}.textContent = '${2:content}'",type:"textContent",description:"Gets or sets the text content of the specified element",fileTypes:["tsx","javascript"]},{prefix:"qs",snippet:"${1:document}.querySelector('${2:selector}')",type:"querySelector",description:"Returns the first element within the DOM that matches the specified selector(s)",fileTypes:["tsx","javascript"]},{prefix:"qsa",snippet:"${1:document}.querySelectorAll('${2:selector}')",type:"querySelectorAll",description:"Returns a NodeList of all elements within the DOM that matches the specified selector(s)",fileTypes:["tsx","javascript"]}];var{snippetManager:_}=ace.require("ace/snippets"),D=acode.require("selectionMenu"),a=acode.require("settings"),{editor:o}=editorManager,c=class{constructor(){this.setVariables(),this.initializeAutocompletion(g||[]),a.value[i.id]||(a.value[i.id]={snippetDocs:!1},a.update(!1))}setVariables(){let{variables:t}=_;t.FILE_NAME=()=>{let s=editorManager.activeFile.filename,r=s.lastIndexOf(".");return s.slice(0,r)}}initializeAutocompletion(t){this.reactCompleter={getCompletions:(s,r,p,f,l)=>{let v=h(r),d=t.filter(n=>n.fileTypes.includes(v));d.length>0?l(null,d.map(n=>{let x={caption:n.prefix,snippet:n.snippet,meta:n.type,value:n.snippet,type:"snippet",docHTML:n.description||""};return typeof extraSyntaxHighlightsInstalled<"u"&&extraSyntaxHighlightsInstalled?{...x,icon:"icon react-snippet-icon"}:x})):l(null,[])}},o.completers.unshift(this.reactCompleter)}async init(t,s,r){if(this.settings.snippetDocs){let p=document.createElement("style");p.id="overideCompletionDocs",p.innerHTML=`
521 | .ace_tooltip.ace_doc-tooltip {
522 | display: flex !important;
523 | background-color: var(--secondary-color);
524 | color: var(--secondary-text-color);
525 | max-width: 68%;
526 | white-space: pre-wrap;
527 | }
528 | `,document.head.append(p)}acode.addIcon("react-snippet-icon",this.baseUrl+"icon.png"),D.add(this.convertToJsx.bind(this),"JSX","selected")}convertToJsx(){let t=o.getSelectionRange(),s=o.getSelectedText(),r=j(s);o.getSession().replace(t,r),window.toast("Converted \u{1F4A5}",3e3)}get settingsObj(){return{list:[{key:"snippetDocs",text:"Enable snippet docs",checkbox:!!this.settings.snippetDocs,info:"To show brief docs about the snippets"}],cb:(t,s)=>{if(this.settings[t]=s,a.update(),s==!0){let r=document.createElement("style");r.id="overideCompletionDocs",r.innerHTML=`
529 | .ace_tooltip.ace_doc-tooltip {
530 | display: flex !important;
531 | background-color: var(--secondary-color);
532 | color: var(--secondary-text-color);
533 | max-width: 68%;
534 | white-space: pre-wrap;
535 | }
536 | `,document.head.append(r)}else s==!1&&document.querySelector("overideCompletionDocs").remove()}}}get settings(){return a.value[i.id]}async destroy(){o.completers.splice(o.completers.indexOf(this.reactCompleter),1),document.querySelector("overideCompletionDocs").remove()}};if(window.acode){let e=new c;acode.setPluginInit(i.id,async(t,s,{cacheFileUrl:r,cacheFile:p})=>{t.endsWith("/")||(t+="/"),e.baseUrl=t,await e.init(s,p,r)},e.settingsObj),acode.setPluginUnmount(i.id,()=>{e.destroy()})}
537 |
--------------------------------------------------------------------------------
/docs/Snippets.md:
--------------------------------------------------------------------------------
1 | # Snippets
2 |
3 | This documentation is built upon the [vscode-react-javascript-snippets
4 | ](https://github.com/ults-io/vscode-react-javascript-snippets/blob/master/docs/Snippets.md) documentation.
5 |
6 | ## Snippets info
7 |
8 | Every space inside `{ }` and `( )` means that this is pushed into next line :)
9 | `$` represent each step after `tab`.
10 |
11 | _TypeScript_ has own components and own snippets. Use search or just type `ts` before every component snippet.
12 |
13 | I.E. `tsrcc`
14 |
15 |
16 |
17 | ### React Hooks
18 |
19 | - Hooks from [official docs](https://reactjs.org/docs/hooks-reference.html) are added with hook name as prefix.
20 |
21 | ### Basic Methods
22 |
23 | | Prefix | Method |
24 | | -------: | --------------------------------------------------- |
25 | | `imp→` | `import moduleName from 'module'` |
26 | | `imn→` | `import 'module'` |
27 | | `imd→` | `import { destructuredModule } from 'module'` |
28 | | `ime→` | `import * as alias from 'module'` |
29 | | `ima→` | `import { originalName as aliasName} from 'module'` |
30 | | `exp→` | `export default moduleName` |
31 | | `exd→` | `export { destructuredModule } from 'module'` |
32 | | `exa→` | `export { originalName as aliasName} from 'module'` |
33 | | `enf→` | `export const functionName = (params) => { }` |
34 | | `edf→` | `export default (params) => { }` |
35 | | `ednf→` | `export default function functionName(params) { }` |
36 | | `met→` | `methodName = (params) => { }` |
37 | | `fre→` | `arrayName.forEach(element => { }` |
38 | | `fof→` | `for(let itemName of objectName { }` |
39 | | `fin→` | `for(let itemName in objectName { }` |
40 | | `anfn→` | `(params) => { }` |
41 | | `nfn→` | `const functionName = (params) => { }` |
42 | | `dob→` | `const {propName} = objectToDescruct` |
43 | | `dar→` | `const [propName] = arrayToDescruct` |
44 | | `sti→` | `setInterval(() => { }, intervalTime` |
45 | | `sto→` | `setTimeout(() => { }, delayTime` |
46 | | `prom→` | `return new Promise((resolve, reject) => { }` |
47 | | `cmmb→` | `comment block` |
48 | | `cp→` | `const { } = this.props` |
49 | | `cs→` | `const { } = this.state` |
50 | | `req→` | `const ${1:packageName} = require('${1:package}')` |
51 | | `call→` | `${1:method}.call(${2:context}, ${3:arguments})` |
52 | | `apply→` | `${1:method}.apply(${2:context}, ${3:arguments})` |
53 | | `jp→` | `JSON.parse(${1:obj})` |
54 | | `js→` | `JSON.stringify(${1:obj})` |
55 | | `us→` | `'use strict'` |
56 | | `al→` | `alert('${1:message}')` |
57 | | `pr→` | `prompt('${1:message}')` |
58 | | `cf→` | `confirm('${1:message}')` |
59 |
60 | ### React
61 |
62 | | Prefix | Method |
63 | | ----------: | --------------------------------------------------------------------------- |
64 | | `imr→` | `import React from 'react'` |
65 | | `imrd→` | `import ReactDOM from 'react-dom'` |
66 | | `imrc→` | `import React, { Component } from 'react'` |
67 | | `imrpc→` | `import React, { PureComponent } from 'react'` |
68 | | `imrm→` | `import React, { memo } from 'react'` |
69 | | `imrr→` | `import { BrowserRouter as Router, Route, NavLink} from 'react-router-dom'` |
70 | | `imbr→` | `import { BrowserRouter as Router} from 'react-router-dom'` |
71 | | `imbrc→` | `import { Route, Switch, NavLink, Link } from react-router-dom'` |
72 | | `imbrr→` | `import { Route } from 'react-router-dom'` |
73 | | `imbrs→` | `import { Switch } from 'react-router-dom'` |
74 | | `imbrl→` | `import { Link } from 'react-router-dom'` |
75 | | `imbrnl→` | `import { NavLink } from 'react-router-dom'` |
76 | | `imrs→` | `import React, { useState } from 'react'` |
77 | | `imrse→` | `import React, { useState, useEffect } from 'react'` |
78 | | `redux→` | `import { connect } from 'react-redux'` |
79 | | `est→` | `this.state = { }` |
80 | | `cdm→` | `componentDidMount = () => { }` |
81 | | `scu→` | `shouldComponentUpdate = (nextProps, nextState) => { }` |
82 | | `cdup→` | `componentDidUpdate = (prevProps, prevState) => { }` |
83 | | `cwun→` | `componentWillUnmount = () => { }` |
84 | | `gdsfp→` | `static getDerivedStateFromProps(nextProps, prevState) { }` |
85 | | `gsbu→` | `getSnapshotBeforeUpdate = (prevProps, prevState) => { }` |
86 | | `sst→` | `this.setState({ })` |
87 | | `ssf→` | `this.setState((state, props) => return { })` |
88 | | `props→` | `this.props.propName` |
89 | | `state→` | `this.state.stateName` |
90 | | `rcontext→` | `const $1 = React.createContext()` |
91 | | `cref→` | `this.$1Ref = React.createRef()` |
92 | | `fref→` | `const ref = React.createRef()` |
93 | | `bnd→` | `this.methodName = this.methodName.bind(this)` |
94 |
95 | ### React Native
96 |
97 | | Prefix | Method |
98 | | ---------: | -------------------------------------- |
99 | | `imrn→` | `import { $1 } from 'react-native'` |
100 | | `rnstyle→` | `const styles = StyleSheet.create({})` |
101 |
102 | ### Redux
103 |
104 | | Prefix | Method |
105 | | -----------: | ------------------------- |
106 | | `rxaction→` | `redux action template` |
107 | | `rxconst→` | `export const $1 = '$1'` |
108 | | `rxreducer→` | `redux reducer template` |
109 | | `rxselect→` | `redux selector template` |
110 | | `rxslice→` | `redux slice template` |
111 |
112 | ### PropTypes
113 |
114 | | Prefix | Method |
115 | | --------: | ---------------------------------------- |
116 | | `pta→` | `PropTypes.array` |
117 | | `ptar→` | `PropTypes.array.isRequired` |
118 | | `ptb→` | `PropTypes.bool` |
119 | | `ptbr→` | `PropTypes.bool.isRequired` |
120 | | `ptf→` | `PropTypes.func` |
121 | | `ptfr→` | `PropTypes.func.isRequired` |
122 | | `ptn→` | `PropTypes.number` |
123 | | `ptnr→` | `PropTypes.number.isRequired` |
124 | | `pto→` | `PropTypes.object` |
125 | | `ptor→` | `PropTypes.object.isRequired` |
126 | | `pts→` | `PropTypes.string` |
127 | | `ptsr→` | `PropTypes.string.isRequired` |
128 | | `ptnd→` | `PropTypes.node` |
129 | | `ptndr→` | `PropTypes.node.isRequired` |
130 | | `ptel→` | `PropTypes.element` |
131 | | `ptelr→` | `PropTypes.element.isRequired` |
132 | | `pti→` | `PropTypes.instanceOf(name)` |
133 | | `ptir→` | `PropTypes.instanceOf(name).isRequired` |
134 | | `pte→` | `PropTypes.oneOf([name])` |
135 | | `pter→` | `PropTypes.oneOf([name]).isRequired` |
136 | | `ptet→` | `PropTypes.oneOfType([name])` |
137 | | `ptetr→` | `PropTypes.oneOfType([name]).isRequired` |
138 | | `ptao→` | `PropTypes.arrayOf(name)` |
139 | | `ptaor→` | `PropTypes.arrayOf(name).isRequired` |
140 | | `ptoo→` | `PropTypes.objectOf(name)` |
141 | | `ptoor→` | `PropTypes.objectOf(name).isRequired` |
142 | | `ptsh→` | `PropTypes.shape({ })` |
143 | | `ptshr→` | `PropTypes.shape({ }).isRequired` |
144 | | `ptany→` | `PropTypes.any` |
145 | | `ptypes→` | `static propTypes = {}` |
146 |
147 | ### Console
148 |
149 | | Prefix | Method |
150 | | ------ | ------------------------------------------------------------ |
151 | | `clg→` | `console.log(object)` |
152 | | `clo→` | `` console.log(`object`, object) `` |
153 | | `clj→` | `` console.log(`object`, JSON.stringify(object, null, 2)) `` |
154 | | `ctm→` | `` console.time(`timeId`) `` |
155 | | `cte→` | `` console.timeEnd(`timeId`) `` |
156 | | `cas→` | `console.assert(expression,object)` |
157 | | `ccl→` | `console.clear()` |
158 | | `cco→` | `console.count(label)` |
159 | | `cdi→` | `console.dir` |
160 | | `cer→` | `console.error(object)` |
161 | | `cgr→` | `console.group(label)` |
162 | | `cge→` | `console.groupEnd()` |
163 | | `ctr→` | `console.trace(object)` |
164 | | `cwa→` | `console.warn` |
165 | | `cin→` | `console.info` |
166 |
167 | ### Array and String methods snippets
168 |
169 | | Prefix | Method |
170 | | -------- | --------------------------------------------------------------------------------------------------------- |
171 | | `fil→` | `${1:array}.filter((${2:element}) => ${3:condition})` |
172 | | `fi→` | `${1:array}.find((${2:element}) => ${3:condition})` |
173 | | `jn→` | `${1:array}.join(${2:separator})` |
174 | | `mp→` | `${1:array}.map((${2:element}, ${3:index}) => ${4:newElements})` |
175 | | `pop→` | `${1:array}.pop(${2:element})` |
176 | | `psh→` | `${1:array}.push(${2:element})` |
177 | | `red→` | `${1:array}.reduce((${2:accumulator}, ${3:currentValue}) => ${4:accumulatorFunction}, ${5:initialValue})` |
178 | | `rev→` | `${1:array}.reverse()` |
179 | | `sh→` | `${1:array}.shift(${2:element})` |
180 | | `unsh→` | `${1:array}.unshift(${2:element})` |
181 | | `spl→` | `${1:array}.splice(${2:start}, ${3:deleteCount}, ${4:elements})` |
182 | | `some→` | `${1:array}.some((${2:el}) => ${3:condition})` |
183 | | `srt→` | `${1:array}.sort((${2:a}, ${3:b}) => ${4:comparisonFunction})` |
184 | | `tostr→` | `${1:array}.toString()` |
185 | | `afrm→` | `Array.from(${1:arrayLike})` |
186 | | `ca→` | `${1:str}.charAt(${2:index})` |
187 | | `ms→` | `${1:str}.match(${2:regex})` |
188 | | `rpt→` | `${1:str}.repeat(${2:count})` |
189 | | `rep→` | `${1:str}.replace(${2:substring}, ${3:replacement})` |
190 | | `repa→` | `${1:str}.replaceAll(${2:substring}, ${3:replacement})` |
191 | | `sw→` | `${1:str}.startsWith(${2:substr})` |
192 | | `ew→` | `${1:str}.endsWith(${2:substr})` |
193 | | `sstr→` | `${1:str}.substring(${2:start}, ${3:end})` |
194 | | `ss→` | `${1:str}.substr(${2:start}, ${3:length})` |
195 | | `tlc→` | `${1:str}.toLowerCase()` |
196 | | `tuc→` | `${1:str}.toUpperCase()` |
197 | | `trm→` | `${1:str}.trim()` |
198 | | `sp→` | `${1:str}.split(${2:delimiter})` |
199 | | `inc→` | `${1:elements}.includes(${2:element}, ${3:start})` |
200 | | `sl→` | `${1:elements}.slice(${2:start}, ${3:end})` |
201 | | `io→` | `${1:elements}.indexOf(${2:element})` |
202 | | `cc→` | `${1:elements}.concat(${2:otherElements})` |
203 | | `lio→` | `${1:str}.lastIndexOf(${2:substr})` |
204 |
205 | ### DOM Snippets
206 |
207 | | Prefix | Method |
208 | | ------- | --------------------------------------------------------------------- |
209 | | `ael→` | `${1:document}.addEventListener('${2:click}', ${3:(e) => {}})` |
210 | | `rel→` | `${1:document}.removeEventListener('${2:click}', ${3:eventListener})` |
211 | | `ac→` | `${1:document}.appendChild(${2:elem})` |
212 | | `rc→` | `${1:document}.removeChild(${2:elem})` |
213 | | `rpc→` | `${1:document}.replaceChild(${2:newChild}, ${3:oldChild})` |
214 | | `inb→` | `${1:parentEl}.insertBefore(${2:newEl}, ${3:refEl})` |
215 | | `ina→` | `${1:parentEl}.insertAdjacentHTML(${2:position}, ${3:el})` |
216 | | `ds→` | `${1:el}.dataset` |
217 | | `gcs→` | `getComputedStyle(${1:el})` |
218 | | `cel→` | `${1:document}.createElement(${2:element})` |
219 | | `cdf→` | `document.createDocumentFragment()` |
220 | | `cla→` | `${1:document}.classList.add('${2:class}')` |
221 | | `clr→` | `${1:document}.classList.remove('${2:class}')` |
222 | | `cla→` | `${1:document}.classList.add('${2:class}')` |
223 | | `clt→` | `${1:document}.classList.toggle('${2:class}')` |
224 | | `gei→` | `${1:document}.getElementById('${2:id}')` |
225 | | `gecn→` | `${1:document}.getElementsByClassName('${2:class}')` |
226 | | `getn→` | `${1:document}.getElementsByTagName('${2:tag}')` |
227 | | `gei→` | `${1:document}.getElementById('${2:id}')` |
228 | | `ga→` | `${1:document}.getAttribute('${2:attr}')` |
229 | | `sa→` | `${1:document}.setAttribute('${2:attr}')` |
230 | | `ra→` | `${1:document}.removeAttribute('${2:attr}')` |
231 | | `ih→` | `${1:document}.innerHTML = '${2:elem}'` |
232 | | `tc→` | `${1:document}.textContent = '${2:content}'` |
233 | | `qs→` | `${1:document}.querySelector('${2:selector}')` |
234 | | `qsa→` | `${1:document}.querySelectorAll('${2:selector}')` |
235 |
236 | ### React Components
237 |
238 | ### `rcc`
239 |
240 | ```javascript
241 | import React, { Component } from "react";
242 |
243 | export default class FileName extends Component {
244 | render() {
245 | return