- MobX Quick Start Guide
- Pavan Podila Michel Weststrate
- 341字
- 2021-08-05 10:34:20
The client state
The UI that you can see and manipulate on screen is the result of painting a visual representation of data. The shape of data hints at the kind of controls you provide for visualizing and manipulating this data. For example, if you have a list of items, you will likely show a List control that has an array of ListItems. Operations may include searching, paginating, filtering, sorting, or grouping the items in the list. The state of these operations is also captured as data and informs the visual representation.
The following diagram shows the direct relationship of an array with a List control:

In short, it is the data that takes on a pivotal role in describing the UI. Handling the structure and managing the changes that can happen to this data is what we commonly refer to as state management. State is just a synonym for the client-data that is rendered on the UI.
As the complexity of the UI increases, more state is accumulated on the client. It gets to a point where state becomes the ultimate source of truth for whatever we see on the screen. This approach to UI development, where we elevate the importance of the client-state, has been one of the biggest shifts in the frontend world. There is an interesting equation that captures this relationship between UI and state:

fn is a transformation function that is applied on the state (the data) that produces a corresponding UI. In fact, a subtle meaning that is hidden here is that, given the same state, fn always produces the same UI.
In the context of React, the preceding equation can be written as follows:

The only difference here is that fn takes two inputs, props and state, which is the prescribed contract of a React component.
- 數(shù)據(jù)通信網(wǎng)絡實踐:基礎(chǔ)知識與交換機技術(shù)
- Web Application Development with R Using Shiny
- 面向云平臺的物聯(lián)網(wǎng)多源異構(gòu)信息融合方法
- 網(wǎng)絡的琴弦:玩轉(zhuǎn)IP看監(jiān)控
- Mastering JavaFX 10
- Mastering TypeScript 3
- Windows Server 2012 Hyper-V虛擬化管理實踐
- 人際網(wǎng)絡
- 區(qū)塊鏈社區(qū)運營手冊
- SEO攻略:搜索引擎優(yōu)化策略與實戰(zhàn)案例詳解
- Hands-On Reactive Programming in Spring 5
- 走近奇妙的物聯(lián)網(wǎng)
- 互聯(lián)網(wǎng)心理學:新心理與行為研究的興起
- 深入淺出計算機網(wǎng)絡
- 賽博空間簡史