- 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.
- 物聯(lián)網(wǎng)標(biāo)準(zhǔn)化指南
- 物聯(lián)網(wǎng)識別技術(shù)
- Truffle Quick Start Guide
- 重新定義Spring Cloud實戰(zhàn)
- 物聯(lián)網(wǎng)安全與深度學(xué)習(xí)技術(shù)
- Windows Server 2003 Active Directory Design and Implementation: Creating, Migrating, and Merging Networks
- 通信簡史:從信鴿到6G+
- 物聯(lián)網(wǎng)與無線傳感器網(wǎng)絡(luò)
- 網(wǎng)絡(luò)環(huán)境中基于用戶視角的信息質(zhì)量評價研究
- TD-LTE無線網(wǎng)絡(luò)規(guī)劃與設(shè)計
- 局域網(wǎng)組成實踐
- 中國互聯(lián)網(wǎng)發(fā)展報告2021
- 5G非正交多址接入技術(shù):理論、算法與實現(xiàn)
- Building RESTful Web Services with .NET Core
- 工業(yè)以太網(wǎng)技術(shù):AFDX/TTE網(wǎng)絡(luò)原理、接口、互連與安全