react-redux-react-native-snippets-snippets package
Some snippets for React/React-Native and Redux for help you to be a faster developer. I try to make it really easy to remember.
Help for:
- React-Native-Router-Flux
- React-Router
More will coming soon.
React
imr
Import React
import React from 'react';
imrc
Import Component React
import React, { Component } from 'react';
sl
Stateless Component
const ${1} = () => (
${2}
);
export default ${1};
rrr
React-Router route
<Route path="${1}" component={${2}} />
ed
Export Default
export default ${1};
r
return
return ${1};
rcc
class React component es6
class ${1} extends Component {
render() {
return (
${2}
);
}
}
export default ${1};
React Component Lifecycle
cwm
componentWillMount
componentWillMount() {
${1}
}
cdm
componentDidMount
componentDidMount() {
${1}
}
cwum
componentWillUnmount
componentWillUnmount() {
${1}
}
cwu
componentWillUpdate
componentWillUpdate() {
${1}
}
cdu
componentDidUpdate
componentDidUpdate() {
${1}
}
Redux
'ins' INITIAL_STATE
const INITIAL_STATE = {
${1}
};
rrd
Redux Reducer
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case ${1}:
default:
return state;
}
};
rt
Redux Types
export const ${1} = '${1}';
React-Native
imrn
Import React-Native
import { ${1} } from 'react-native';
rnvt
React-Native Text and View
import {
View,
Text
} from 'react-native';
rnsc
React-Native scene
<Scene
key="${1}"
title="${2}"
component={${3}}
/>