当前位置:网站首页>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边栏推荐
- Flutter assembly
- 面试官:你简历上说精通mysql,那你说下聚簇/联合/覆盖索引、回表、索引下推
- cmd。。。。。。
- 不要小看了积分商城,它的作用可以很大!
- 赫尔辛基交通安全改善项目部署Velodyne Lidar智能基础设施解决方案
- Bugly hot update usage
- Describe your understanding of the evolution process and internal structure of the method area
- Helsinki traffic safety improvement project deploys velodyne lidar Intelligent Infrastructure Solution
- Gold three silver four, an article to solve the resume and interview
- Hash table, generic
猜你喜欢

Swift responsive programming

Beginner bug set

What exactly is a handler

Rxjs TakeUntil 操作符的学习笔记

Continuous integration of aspnetcore & cloud flow

商城风格也可以很多变,DIY了解一下!

Alvaria宣布客户体验行业资深人士Jeff Cotten担任新首席执行官

Precautions for function default parameters (formal parameter angle)

合宙Air32F103CBT6開發板上手報告
Mixed density network (MDN) for multiple regression explanation and code example
随机推荐
What can one line of code do?
Consumer and producer cases of inter thread synchronization (condition variable)
深度学习 pytorch cifar10数据集训练「建议收藏」
Rxjs TakeUntil 操作符的学习笔记
What processes are needed to build a wechat applet from scratch?
Power representation in go language
MT60B1G16HC-48B:A美光内存颗粒FBGA代码D8BNK[通俗易懂]
Advanced SQL statement 1 of Linux MySQL database
The paid video at station B caused the up master to lose more than ten thousand fans
Webgl and webgpu comparison [4] - uniform
Uniapp converts graphic verification codes in the form of file streams into images
Free books! AI across the Internet paints old photos. Here is a detailed tutorial!
[untitled]
Continuous integration of aspnetcore & cloud flow
Nsurlsession learning notes (III) download task
Error: homebrew core is a shallow clone
Read the configuration, explain the principle and read the interview questions. I can only help you here...
Continuously improve the overall performance of adaoracle Oracle Oracle
leetcode-8. String to integer (ATOI)
Helsinki traffic safety improvement project deploys velodyne lidar Intelligent Infrastructure Solution