404 Not Found
因為作者說了,這玩意是從Flux的概念來的,所以先提一下Flux。
故事(?)要從React的state跟props開始說起。在React中,props
為從父元件傳遞下來的屬性值,子元件沒有更動權利;state
為元件自己的屬性值,可以透過setState更改。
這會造成一個問題,當專案越大的時候,可能很多地方都會用到同樣的資料,但當一個元件去更動資料時,不是每個元件都會知道。
所以有人提供一個解決方案,單向資料流。
元件要對資料進行更動時,會觸發action,然後經由這個路徑一層一層把更新的資料發布出去,讓所有用到這個資料的元件都知道,如此便比較容易知道。
好感人喔。
因為Flux不是重點,所以就跳過Flux的名詞解釋了,自己去看。
參考資料:【Day17】 從哪來到哪去 - Data Flow - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天
承上文,Redux參考了Flux提出的資料流概念,
npm install redux
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing