条件渲染的上下文是否属于数据计算机?
我终于将Xstate集成到我的工作项目中,因为我喜欢它,我很高兴能展示结构良好的状态可以做些什么来进行性能和推理,但是我正在为一些建模而苦苦挣扎。我有一个weathermachine
,该根据lat/long获得当前温度,并连接到我的应用中的地图,因此当用户移动它时,天气会加载。我的工作都很好,但是如果用户放大过多,我不想显示天气,因为当您查看大面积时,这并不是那么有用。我的建模问题是隐藏天气是否属于天气机器。我的一部分认为,当我被要求时它应该只能天气天气。为hideweather
添加某些上下文是最简单的,但是“正确吗?”是最简单的。对您所有人使用的方法的任何反馈都将不胜感激。
I'm finally integrating xstate into my work project because I love it and I'm excited to show off what well-structured states can do for performance and reasoning, but I'm struggling with a bit of modeling. I have a weatherMachine
that gets the current temperature based on lat/long and is connected to a map in my app, so when the user moves it, the weather loads. I have that all working beautifully but if the user zooms out too much, I don't want to show weather, as it's not all that useful when you're viewing a large area. My modeling question is whether or not hiding the weather belongs in the weather machine. Part of me thinks it should just get weather when asked to but the point at which I dispatch the event to load weather (onMapRegionChange
) is also the place I'd check the zoom level and show/hide the weather. It'd be simplest to add some context to the weather machine for hideWeather
but is that "correct?" Any feedback on the approach you all would use would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论