当前位置: 首页 > news >正文

网站软文营销曼联vs恩波利比分

网站软文营销,曼联vs恩波利比分,wap网站怎么打开,如何跳过网站会员VS Code React Snippets 使用指南 目录 简介基础方法React 相关React Native 相关Redux 相关PropTypes 相关控制台相关React 组件相关 简介 ES7 React/Redux/GraphQL/React-Native snippets 是一个用于 VS Code 的代码片段插件,它提供了大量用于 React 开发的代…

VS Code React Snippets 使用指南

目录

  1. 简介
  2. 基础方法
  3. React 相关
  4. React Native 相关
  5. Redux 相关
  6. PropTypes 相关
  7. 控制台相关
  8. React 组件相关

简介

ES7+ React/Redux/GraphQL/React-Native snippets 是一个用于 VS Code 的代码片段插件,它提供了大量用于 React 开发的代码模板。
官网:[https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets]

安装方法

  1. 打开 VS Code
  2. 按下 Ctrl+P (Windows) 或 Cmd+P (Mac)
  3. 输入 ext install rodrigovallades.es7-react-js-snippets

支持的文件类型

  • JavaScript (.js)
  • JavaScript React (.jsx)
  • TypeScript (.ts)
  • TypeScript React (.tsx)

基础方法

导入导出

前缀方法
imp→import moduleName from 'module'
imn→import 'module'
imd→import { destructuredModule } from 'module'
ime→import * as alias from 'module'
ima→import { originalName as aliasName} from 'module'
exp→export default moduleName
exd→export { destructuredModule } from 'module'
exa→export { originalName as aliasName} from 'module'

函数相关

// anfn→ 箭头函数
(params) => { }// nfn→ 命名函数
const functionName = (params) => { }// dob→ 解构对象
const {propName} = objectToDescruct// dar→ 解构数组
const [propName] = arrayToDescruct

React 相关

导入语句

// imr→ 导入 React
import React from 'react'// imrd→ 导入 ReactDOM
import ReactDOM from 'react-dom'// imrc→ 导入 React 和 Component
import React, { Component } from 'react'// imrcp→ 导入 React、Component 和 PropTypes
import React, { Component } from 'react'
import PropTypes from 'prop-types'

生命周期方法

// cdm→ componentDidMount
componentDidMount = () => { }// cdup→ componentDidUpdate
componentDidUpdate = (prevProps, prevState) => { }// cwun→ componentWillUnmount
componentWillUnmount = () => { }

React 组件相关

类组件

// rcc→ 类组件
import React, { Component } from 'react'export default class FileName extends Component {render() {return <div>$2</div>}
}// rce→ 类组件带导出
import React, { Component } from 'react'export class FileName extends Component {render() {return <div>$2</div>}
}export default FileName

函数组件

// rfce→ 函数组件带导出
import React from 'react'function FileName() {return <div>$0</div>
}export default FileName// rafc→ 箭头函数组件
import React from 'react'const FileName = () => {return <div>$0</div>
}export default FileName

PropTypes 相关

类型定义

// pta→ PropTypes.array
PropTypes.array// ptar→ PropTypes.array.isRequired
PropTypes.array.isRequired// ptb→ PropTypes.bool
PropTypes.bool// ptbr→ PropTypes.bool.isRequired
PropTypes.bool.isRequired// pts→ PropTypes.string
PropTypes.string// ptsr→ PropTypes.string.isRequired
PropTypes.string.isRequired

Redux 相关

// rxaction→ Redux Action
export const actionName = (payload) => ({type: 'ACTION_TYPE',payload
})// rxconst→ Redux Constant
export const ACTION_TYPE = 'ACTION_TYPE'// rxreducer→ Redux Reducer
const initialState = {}export default (state = initialState, { type, payload }) => {switch (type) {case typeName:return { ...state, ...payload }default:return state}
}

React Native 相关

// rnc→ React Native 类���件
import React, { Component } from 'react'
import { View, Text } from 'react-native'export default class FileName extends Component {render() {return (<View><Text>$2</Text></View>)}
}// rncs→ React Native 类组件带样式
import React, { Component } from 'react'
import { Text, StyleSheet, View } from 'react-native'export default class FileName extends Component {render() {return (<View><Text>$2</Text></View>)}
}const styles = StyleSheet.create({})

控制台相关

// clg→ console.log
console.log(object)// clo→ console.log object with name
console.log('object', object)// ctr→ console.trace
console.trace(object)// cwa→ console.warn
console.warn(object)// cin→ console.info
console.info(object)

最佳实践

  1. 使用快捷键提高开发效率
  2. 熟记常用的代码片段前缀
  3. 根据项目需求选择合适的代码片段
  4. 配合 VS Code 的其他功能使用

注意事项

  1. 代码片段中的 $1, $2 等表示光标位置
  2. 使用 Tab 键在不同位置之间切换
  3. 某些代码片段可能需要根据项目实际情况修改
  4. 建议先了解代码片段的完整内容再使用
http://www.jinmujx.cn/news/108615.html

相关文章:

  • 济济南市建设委员会 网站谷歌推广公司哪家好
  • 品牌高端网站制作机构技术培训机构排名前十
  • 网站建设 响应式 北京重庆关键词自然排名
  • 商会网站建设方案百度知道网页版进入
  • 网站设计的优点和缺点万网注册域名查询官方网站
  • 廊坊建设网站网页优化方案
  • 谁给个好网站线上宣传方案
  • 深圳营销网站建设模板站长之家查询工具
  • 昆明建设咨询监理有限公司网站信息发布平台推广
  • 室内设计师需要学什么软件seo高级优化方法
  • 怎样购买起名软件自己做网站技术优化seo
  • 自己做网站需要学什么定制网站建设推广服务
  • 可以做很多个网站然后哭推广推广怎么做
  • 做网站必须要公司才能做吗互联网营销方式有哪些
  • php的网站模板百度快照客服
  • 网站建设有几块小程序开发系统
  • 网站建设公司汉狮网络全网营销代运营
  • wordpress基础主题站2021年新闻摘抄
  • 延安网站建设公司电话百度网站优化
  • 为什么网站建设需要每年续费营销模式方案
  • 中国中建设计网站福建seo顾问
  • 苏州营销网站建设深圳百度seo公司
  • 私人找人做网站新网站怎么做优化
  • 福州自助建站网站谷歌建站
  • 私人订制网站推荐电子商务推广
  • 网站建设实训日志手机百度最新正版下载
  • WordPress网站hym地图网页设计排版布局技巧
  • 设计网站视频教程外贸订单一般在哪个平台接
  • 上海网站设计建设长尾关键词什么意思
  • wordpress导航网站模板下载重庆seo优