This folder contains my tests and experiments with react a frontend UI framework.
This README contains some notes on React.
Most React projects would be setup in a similar fashion. I use VSCode on Linux for editing code and hence my setup would reflect the same.
Creating a new react project is an easy step using create-react-app:
$ npx create-react-app <project-name>
This creates a project setup with files in a new folder named after the project-name
. Note that this setup uses yarn as the default package manager.
Install ESLint plugin for VSCode: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
This must be run on a per project basis. Although you can install it globally as well.
yarn add eslint eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react -D
Libraries installed in this command:
- eslint
- eslint-plugin-import
- eslint-plugin-jsx-a11y
- eslint-plugin-react
This file should be located at the root directory of your react project and is used as settings for eslint. These settings work well for me. Modify them as you please.
{
"extends": ["react-app"],
"env": {
"browser": true,
"node": true
},
"rules": {
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
],
"no-console": 0,
"react/no-unused-state": 1
}
}
These are the settings for VSCode. They can be edited by going to settings (Ctrl +
) then clicking the
{}` icon.
{
// ... Other Settings ...
// ESLint
// formatting using eslint
// let editor format using prettier for all other files
"editor.formatOnSave": true,
// available through eslint plugin in vscode
"eslint.autoFixOnSave": true,
"eslint.alwaysShowStatus": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true
}
It is used for REST API Requests. It is based on ES6 promises.
$ yarn add axios
It is used to route links through react. It is helpful in Single Page Applications (SPAs).
$ yarn add react-router-dom
Adds support for sass file imports and auto-compiling.
https://www.npmjs.com/package/react-html5-camera-photo
- JSONPlaceholder - Provides sample API and data