react snippets code example

Example 1: visual studio code create react component shortcut

//  Shortcut to write react code
Install extension(vscode)-- Reactjs code snippets (charalampos karypidis)
-> means Tab 
rcc->  == class component skeleton
rsc->  == stateless component skeleton
rsf->  == stateless named function skeleton

To see more, visit-- https://marketplace.visualstudio.com/items?itemName=xabikos.ReactSnippets

Example 2: arrow function component react shortcut vscode

import React from 'react'
import { View, Text } from 'react-native'

export default function $1() {
  return (
    
       $2 
    
  )
}

Example 3: arrow function component react shortcut vscode

import React from 'react'
import PropTypes from 'prop-types'

function $1(props) {
  return 
$0
} $1.propTypes = {} export default $1

Example 4: arrow function component react shortcut vscode

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'

export class FileName extends Component {
  static propTypes = {
    $2: $3,
  }

  render() {
    return 
$4
} } const mapStateToProps = (state) => ({}) const mapDispatchToProps = {} export default connect(mapStateToProps, mapDispatchToProps)(FileName)

Tags:

Misc Example