脚本宝典收集整理的这篇文章主要介绍了[JS Pattern] Container / Presentational Pattern,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Presnetational Component:
A presentational compoentn receives its data through props. It's primary function is to simply display the data it receives the way we want them to, including sytles, without modiying that data.
Container Component:
Container component is to pass data to presentational component. Since they don't render anything themselves, they usually do not contain any styling either.
In many cases, the Container / Presentational pattern can be replaced with React Hooks. The introduction of Hooks made it easy for developers to add statefulness without needing a container component to provide that state;
Pros / Cons
Pros:
Cons:
[Note]: From JS Patterns book
以上是脚本宝典为你收集整理的[JS Pattern] Container / Presentational Pattern全部内容,希望文章能够帮你解决[JS Pattern] Container / Presentational Pattern所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。