最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Lifting React state up & storybook - Stack Overflow

programmeradmin3浏览0评论

I just joined a new team that has a pattern of "lifting state up" in their React components. So for example - a colour picker component, relies on a parent component to handle onColourChange events and set the colour prop.

This makes sense since it makes those components more flexible, however it also moves complexity to parent components.

What's more, is that looking at tools like Storybook, which the team is pretty keen to use, this pattern would mean more complex stories, which is a downside.

Summary: Is this a common pattern that's widely used?

I'm somewhat experienced in React, but I don't have the depth and breadth of React knowledge at this stage to fully evaluate this. All I know is that I haven't come across this pattern in the past being used as the default - it's more of a case by case basis, whereas here it seems to be the default.

发布评论

评论列表(0)

  1. 暂无评论