Qiku ← Back to library

AI / Coding and Debugging

Separate Container and Presentational Parts

Separate Container and Presentational Parts — Chinese original prompt

这里有一段同时做请求、算派生数据和渲染的代码:[代码片段]。请判断哪些部分属于容器(取数、状态、错误处理),哪些属于展示(只接收 props 渲染),给出两层之间的 props 契约,并指出哪些 props 只是为了顺便往下传、其实可以删掉。
Site original

Chinese original

How to use

展示组件不要直接读全局状态,否则以后没法单独复用和测试。

More in this topic