Pages

Saturday, January 12, 2019

React JS notes

- ES7 to generate quick template

In VS Code, go to 1) Extensions tab  2) Install ES7



This makes creating new JS files easy.

Create new file:  TestFile.js
Type "rce" and press Tab (rcf for function template)
It auto creates this template code:




- UUID (unique id generator)

> CNTL - C to stop dev server
> npm i uuid  (to install package)
> npm start (restart dev server)

import uuid from 'uuid';

id: uuid.v4();   < this will generate the ID


- React Router

> npm i react-router-dom


- HTTP API library (Axios) - can use instead of jQuery or fetch

> npm i axios