\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{jaredcobb} \pdfinfo{ /Title (es7-react-vscode-shortcuts.pdf) /Creator (Cheatography) /Author (jaredcobb) /Subject (ES7 React VSCode Shortcuts Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{2F0BA3} \definecolor{LightBackground}{HTML}{F2EFF9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{ES7 React VSCode Shortcuts Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{jaredcobb} via \textcolor{DarkBackground}{\uline{cheatography.com/135652/cs/28165/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}jaredcobb \\ \uline{cheatography.com/jaredcobb} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 30th May, 2021.\\ Updated 30th May, 2021.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Basic Methods}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{imp→ import moduleName from 'module' \newline imn→ import 'module' \newline imd→ import \{ destructuredModule \} from 'module' \newline ime→ import * as alias from 'module' \newline ima→ import \{ originalName as aliasName\} from 'module' \newline exp→ export default moduleName \newline exd→ export \{ destructuredModule \} from 'module' \newline exa→ export \{ originalName as aliasName\} from 'module' \newline enf→ export const functionName = (params) =\textgreater{} \{ \} \newline edf→ export default (params) =\textgreater{} \{ \} \newline met→ methodName = (params) =\textgreater{} \{ \} \newline fre→ arrayName.forEach(element =\textgreater{} \{ \} \newline fof→ for(let itemName of objectName \{ \} \newline fin→ for(let itemName in objectName \{ \} \newline anfn→ (params) =\textgreater{} \{ \} \newline nfn→ const functionName = (params) =\textgreater{} \{ \} \newline dob→ const \{propName\} = objectToDescruct \newline dar→ const {[}propName{]} = arrayToDescruct \newline sti→ setInterval(() =\textgreater{} \{ \}, intervalTime \newline sto→ setTimeout(() =\textgreater{} \{ \}, delayTime \newline prom→ return new Promise((resolve, reject) =\textgreater{} \{ \} \newline cmmb→ comment block} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{PropTypes}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{pta→ PropTypes.array \newline ptar→ PropTypes.array.isRequired \newline ptb→ PropTypes.bool \newline ptbr→ PropTypes.bool.isRequired \newline ptf→ PropTypes.func \newline ptfr→ PropTypes.func.isRequired \newline ptn→ PropTypes.number \newline ptnr→ PropTypes.number.isRequired \newline pto→ PropTypes.object \newline ptor→ PropTypes.object.isRequired \newline pts→ PropTypes.string \newline ptsr→ PropTypes.string.isRequired \newline ptnd→ PropTypes.node \newline ptndr→ PropTypes.node.isRequired \newline ptel→ PropTypes.element \newline ptelr→ PropTypes.element.isRequired \newline pti→ PropTypes.instanceOf(name) \newline ptir→ PropTypes.instanceOf(name).isRequired \newline pte→ PropTypes.oneOf({[}name{]}) \newline pter→ PropTypes.oneOf({[}name{]}).isRequired \newline ptet→ PropTypes.oneOfType({[}name{]}) \newline ptetr→ PropTypes.oneOfType({[}name{]}).isRequired \newline ptao→ PropTypes.arrayOf(name) \newline ptaor→ PropTypes.arrayOf(name).isRequired \newline ptoo→ PropTypes.objectOf(name) \newline ptoor→ PropTypes.objectOf(name).isRequired \newline ptsh→ PropTypes.shape(\{ \}) \newline ptshr→ PropTypes.shape(\{ \}).isRequired \newline ptany→ PropTypes.any \newline ptypes→ static propTypes = \{\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Components}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{rfc \newline \newline import React from 'react' \newline \newline export default function \$1() \{ \newline return \textless{}div\textgreater{}\$0\textless{}/div\textgreater{} \newline \} \newline \newline \newline rfcp \newline \newline import React from 'react' \newline import PropTypes from 'prop-types' \newline \newline function \$1(props) \{ \newline return \textless{}div\textgreater{}\$0\textless{}/div\textgreater{} \newline \} \newline \newline \$1.propTypes = \{\} \newline \newline export default \$1 \newline \newline \newline rfce \newline \newline import React from 'react' \newline \newline function \$1() \{ \newline return \textless{}div\textgreater{}\$0\textless{}/div\textgreater{} \newline \} \newline \newline export default \$1} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{React}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{imr→ import React from 'react' \newline imrd→ import ReactDOM from 'react-dom' \newline imrc→ import React, \{ Component \} from 'react' \newline imrcp→ import React, \{ Component \} from 'react' \& import PropTypes from 'prop-types' \newline imrpc→ import React, \{ PureComponent \} from 'react' \newline imrpcp→ import React, \{ PureComponent \} from 'react' \& import PropTypes from 'prop-types' \newline imrm→ import React, \{ memo \} from 'react' \newline imrmp→ import React, \{ memo \} from 'react' \& import PropTypes from 'prop-types' \newline impt→ import PropTypes from 'prop-types' \newline imrr→ import \{ BrowserRouter as Router, Route, NavLink\} from 'react-router-dom' \newline imbr→ import \{ BrowserRouter as Router\} from 'react-router-dom' \newline imbrc→ import \{ Route, Switch, NavLink, Link \} from react-router-dom' \newline imbrr→ import \{ Route \} from 'react-router-dom' \newline imbrs→ import \{ Switch \} from 'react-router-dom' \newline imbrl→ import \{ Link \} from 'react-router-dom' \newline imbrnl→ import \{ NavLink \} from 'react-router-dom' \newline imrs→ import React, \{ useState \} from 'react' \newline imrse→ import React, \{ useState, useEffect \} from 'react' \newline redux→ import \{ connect \} from 'react-redux' \newline cdm→ componentDidMount = () =\textgreater{} \{ \} \newline scu→ shouldComponentUpdate = (nextProps, nextState) =\textgreater{} \{ \} \newline cdup→ componentDidUpdate = (prevProps, prevState) =\textgreater{} \{ \} \newline cwun→ componentWillUnmount = () =\textgreater{} \{ \} \newline gdsfp→ static \seqsplit{getDerivedStateFromProps(nextProps}, prevState) \{ \} \newline gsbu→ getSnapshotBeforeUpdate = (prevProps, prevState) =\textgreater{} \{ \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Redux}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{rxaction→ redux action template \newline rxconst→ export const \$1 = '\$1' \newline rxreducer→ redux reducer template \newline rxselect→ redux selector template \newline rxslice→ redux slice template} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Console}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\seqsplit{clg→ console.log(object)} \newline clo→ console.log('object', object) \newline ctm→ console.time('timeId') \newline cte→ console.timeEnd('timeId') \newline cas→ console.assert(expression,object) \newline ccl→ console.clear() \newline cco→ console.count(label) \newline cdi→ console.dir \newline cer→ console.error(object) \newline cgr→ console.group(label) \newline cge→ console.groupEnd() \newline ctr→ console.trace(object) \newline cwa→ console.warn \newline cin→ console.info} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Components}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{rfcredux \newline \newline import React, \{ Component \} from 'react' \newline import \{ connect \} from 'react-redux' \newline \newline export const FileName = () =\textgreater{} \{ \newline return \textless{}div\textgreater{}\$4\textless{}/div\textgreater{} \newline \} \newline \newline const mapStateToProps = (state) =\textgreater{} (\{\}) \newline \newline const mapDispatchToProps = \{\} \newline \newline export default connect(mapStateToProps, \seqsplit{mapDispatchToProps)(FileName)} \newline \newline \newline rfreduxp \newline \newline import React, \{ Component \} from 'react' \newline import PropTypes from 'prop-types' \newline import \{ connect \} from 'react-redux' \newline \newline export const FileName = () =\textgreater{} \{ \newline return \textless{}div\textgreater{}\$4\textless{}/div\textgreater{} \newline \} \newline \newline FileName.propTypes = \{ \newline \$2: \$3, \newline \} \newline \newline const mapStateToProps = (state) =\textgreater{} (\{\}) \newline \newline const mapDispatchToProps = \{\} \newline \newline export default connect(mapStateToProps, \seqsplit{mapDispatchToProps)(FileName)} \newline \newline \newline reduxmap \newline \newline const mapStateToProps = (state) =\textgreater{} (\{\}) \newline \newline const mapDispatchToProps = \{\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}