GitXplorerGitXplorer
c

all-about-React

public
1 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
d60c3374bc263d973b49c3ccba2239b6646ed2b4

Update README.md

cchengr4 committed 2 years ago
Verified
23733e6db3aff69f15a9ab5d6d8f683d76ae7f78

add notes

cchengr4 committed 2 years ago
Verified
87b042ca167df7cd6057e389531f84b217f4bfec

Update README.md

cchengr4 committed 2 years ago
Verified
09fb026d2b8a9428c40e06d06ec37123a8f4d161

add Reconciliation

cchengr4 committed 2 years ago
Verified
c1c549df4e143e878e7da1e6c285985dc500d02e

about virtual dom

cchengr4 committed 2 years ago
Verified
65d6c1f14d5a9732310ee34c88ad3387a0803188

update rerender component

cchengr4 committed 2 years ago

README

The README file for this repository.

All about React

https://reactjs.org/

Core Ideas

  1. We typically want to perform our effects after React has updated the DOM => put side effects into componentDidMount and componentDidUpdate or useEffect.

In stateless component, return() runs before useEffect()

  1. Props are Read-Only

React Rendering Process

flowchart LR
  Component -->|return| e("Element Object") -->|describe| ht("HTML Tag") 

Eg returned element (object) === Virtual DOM:

{
  type: "main", // string element to an HTML tag (DOM element) || Component
  key: null,
  ref: null, // reference to a real DOM node
  "$$typeof": Symbol(react.element),
  props: {
    children: {
    }
  }
}

Some Tips

Finished Topics

Main Concepts

GO TO MAIN CONCEPTS

Advanced Guides

GO TO ADVANCED GUIDES

API Reference

GO TO API REFERENCE

Hooks

GO TO hooks

Q and A

Q: What causes the component re-render?

A:

  1. The state changes (including global state)
  2. There comes new props [4]

Function component vs Class Component

FC: 每次重新執行函數時,都是傳入獨立的 props,並且 state 也是獨立

CC: based on OOP,may have old props or state

Unknown Prop Warning

https://reactjs.org/warnings/unknown-prop.html

  1. 應避免將由 parent component 使用(interpret) 的 props,forward 至 child component

未整理 or 未理解

Topic to Read

References

  1. https://reactjs.org/
  2. https://chengr4.medium.com/react-%E7%AD%86%E8%A8%98-8b8a39e86655
  3. Lifecycle Diagram
  4. https://github.com/uberVU/react-guide/issues/17#issuecomment-305106051
  5. https://hackmd.io/@JSDC-tw/2021conference/%2FbJrOFuCZQQioW7k6LarlOw 6 Anthony Garritano; Understanding React's UI Rendering Process (2019.11)