React Foundation

readme - Default create-react-app README.md

Reference

creat-react-app

  1. install Node.js
  2. create react app via different approach
Approach Steps
npx $ npx create-react-app <project-name>
npm 1. $ npm install create-react-app -g
2. $ create-react-app <projct-name>

Note: npx is a tool for executing Node packages

link - Stack Overfloe: Difference between npx and npm?

Folder Structure

react-app
├── node_modules
├── package.json
├── package-lock.json
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
└── src
    ├── index.js
    ├── ...
    └── ...
  • package.json: Contain the dependencies and the script required for the project
  • package-lock.json: Ensure consistent installation of the dependencies
  • node_modules: The folder all the dependencies are installed
  • public folder
    • manifest.json: Concerned with progressive web app
    • favicon.ico: Icon we see in the browser tab
    • index.html: The only html file we have in the application, it's mean we're building single page applicatioin
  • src
    • index.js: the starting point of the application

React Foundation - Component

picture - React component overview

Styling in react

link - youtube tutorial vedio

Grouping children without adding extra nodes - Fragment

readme - Fragment detail

Improve Performance

Access DOM node directly within react - Refs

Render children into a DOM node that exists outside the DOM hierarchy of the parent component - ReactDOM.createPortal

Share common functionality between components

Context

Context provides a way to pass data through the component tree without having to pass props down manually at every level.

steps

  1. Create the context
  2. Provide a context value
  3. Consume the context value

readme - context detail

HTTP and React