当前位置:网站首页>Bombard the headquarters. Don't let a UI framework destroy you
Bombard the headquarters. Don't let a UI framework destroy you
2022-06-25 16:22:00 【InfoQ】
Destroy your vision
Destroy your skills
Ruin your state management
Ruin your project
take UI The frame pulls down the altar
The core of application is business logic
Don't over rely UI layer
- UI say : The application needs to be revised , The skin 、 Interaction 、 Page organization should be adjusted , How long will it take? ?
- The product says : hold H5 change , Make a little program 、APP Well , How long will it take? ?
- The manager said :React People are too difficult to recruit , Why don't we change to Vue Well , How long will it take? ?
- Leader say :Vue3 Come out , Let's upgrade to the latest version , How long will it take? ?
Homogeneous UI frame
Revisit the software architecture
Reinvigorate Flux frame
ReduxVuexPiniaEluxfrom State To Model
ComponentStateModel- ComponentState yes UI Logic , Should be encapsulated in Component Inside , The outside world doesn't need to know .
- Model It's business logic , Reflect the whole APP The state of , And Component irrelevant , It should be done by Flux Framework for unified management .
from Event To Action
- Handle Event Of Handler yes UI Logic , It should be written in UI In the component
- Handle Action Of Handler It's business logic , It should be written in Controller Inside
- Verify that the input is valid
- Verify that the current user is logged in
- Request backend API, And wait to return
- If it works , Save user information , And jump back to the original page
- If you fail , Prompt error , And stay where you are
ControllerController
improvement Flux frame
- Global centralized management leads to over centralized logic ;
- Single instance 、 It is easy to cause information accumulation and explosion if not destroyed ;
- DispatchAction The mechanism is too simple , It is not suitable for long process business dealing with cause and effect .
- Although we insist on overall centralized management , but Elux Put forward “ Micro module ” The concept of , The split layer will be applied independently and autonomously “ Micro module ”, Each micro module only deals with things in its own domain .
- No more single instances , Each route change creates a new blank Store, Then re select the useful state to mount , Similar to a garbage collection mechanism .
- Put forward ActionBus The concept of , Give Way Action As Model To broadcast .
- Give Way Action The processing chain of has “ coroutines ” Mechanism , Better coordinate the association between business actions .
Model driven
light UI、 heavy ModelReact/Vue/ More others UI frame NextJSNuxtJSUI Logic and business logic 
throw away a brick in order to get a gem
ReduxMobxVuexPinia边栏推荐
- Gold three silver four, an article to solve the resume and interview
- 不要小看了积分商城,它的作用可以很大!
- About the use of Aidl, complex data transmission
- 一行代码可以做什么?
- 元宇宙系统的概念解析
- What can NFT metauniverse development do?
- Shuttle pop-up returns to the upper level
- Reverse series to obtain any wechat applet code
- The release of autok3s v0.5.0 continues to be simple and friendly
- What are the reasons why the game industry needs high defense servers?
猜你喜欢

How to reload the win10 app store?
Power representation in go language

Share the code technology points and software usage of socket multi client communication

Blue Bridge Cup - practice system login

Lecun predicts AgI: big model and reinforcement learning are both ramps! My "world model" is the new way

Precautions for function default parameters (formal parameter angle)

GO语言-什么是临界资源安全问题?

The style of the mall can also change a lot. DIY can learn about it!

Free books! AI across the Internet paints old photos. Here is a detailed tutorial!

Geographic location data storage scheme - redis Geo
随机推荐
In the wechat environment, H5 jumps to the specified page of the applet
[issue 24] one year experience of golang to develop futu
Beginner bug set
Native JS dynamically add elements
数据存储和传输文件之XML使用和解析详解
[problem solving] dialogfragment can not be attached to a container view
Golang open source streaming media audio and video network transmission service -lal
Go language - what is critical resource security?
Data type variable operator
Free books! AI across the Internet paints old photos. Here is a detailed tutorial!
心楼:华为运动健康的七年筑造之旅
About the use of Aidl, complex data transmission
leetcode-8. 字符串转换整数 (atoi)
Create raspberry PI image file of raspberry pie
Why does golang's modification of slice data affect the data of other slices?
Catheon gaming appointed mark Aubrey, former Asia Pacific head of Activision Blizzard, as CEO
Introduction to MgO 256gb NAND flash chip
Share the code technology points and software usage of socket multi client communication
教务系统开发(PHP+MySQL)
Mt60b1g16hc-48b:a micron memory particles FBGA code d8bnk[easy to understand]