React.js


React official blog

https://facebook.github.io/react/blog/


React.js environment for development

React.js environment for development

Create simple react project manually

React.js testing

React.js Material UI

React.js And Bootstrap

Sass styles in create-react-app

Server Side Rendering

Spinners for react apps


New react app can be created by next command

$ npx create-react-app myapp

if npx is not installed:

# npm i -g npx


Override default port for react app

“start”: “PORT=8080 react-scripts start”,


Component life cycle

componentWillMount
componentDidMount

componentWillUnmount

componentWillReceiveProps(nextProps)
shouldComponentUpdate(nextProps, nextState)
componentWillUpdate(nextProps, nextState)
componentDidUpdate(prevProps, prevState)


Possible SPA routing script

const express = require("express");
const path = require("path");

const server = express();

server.use(express.static("public"));

server.get("*", (req, res) => {
  fs.readFile(`${__dirname}/dist/index.html`, (err, html) => {
    if (error) throw error;

    res.setHeader("Content-Type", "text/html");
    res.end(html);
  });
});

server.listen("8080", () => {
  console.log("Express listening on port 8080");
});