Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于React #11559

Closed
codthing opened this issue Apr 1, 2022 · 6 comments
Closed

关于React #11559

codthing opened this issue Apr 1, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@codthing
Copy link

codthing commented Apr 1, 2022

这个特性解决了什么问题?

目前正在考虑市面上开发微信小程序的第三方框架,请问这个Taro架构支持React的全新属性吗?支持全新的React18吗?例如Hooks、并发渲染等等,对React的支持度到哪种程度?需要注意一些什么问题?

这个 API 长什么样?

我期望的API是,React、NextJS等怎么开发,Taro就怎么开发,做到开发没有区别,剩下的交给你们底层去处理,对开发者友好。

@pangnate
Copy link

pangnate commented Apr 2, 2022

想知道这些问题,我感觉先去爬爬文档,自己写个demo比较快

@AdvancedCat
Copy link
Member

AdvancedCat commented Apr 12, 2022

目前Taro3.4版本内使用的是React17版本,所以Hooks、并发渲染(是batchUpdate吗?)应该都是支持的。

至于React 18,它在路上了 --> #11610
欢迎提意见!

@codthing
Copy link
Author

@AdvancedCat
good job

@geekact
Copy link

geekact commented Apr 15, 2022

并发渲染(是batchUpdate吗?)

@AdvancedCat 并发渲染是指 concurrent rendering,需要额外支持。比如一些状态库需要配合 useSyncExternalStore 才行能适配react18,否则在React18下数据有可能被 tearing(撕裂)

@AdvancedCat
Copy link
Member

@geekact 哇,好深奥。大佬可否提供类似的demo场景,方便我用来测试呢?

@geekact
Copy link

geekact commented Apr 15, 2022

@AdvancedCat 研究如何测试并发渲染好几天了,可以参考我在react状态库中的一个测试 https://github.com/foca-js/foca/blob/master/test/concurrent.test.tsx#L58 。(写法感觉不够巧妙)

react-redux@7是未兼容react18的版本,所以useDeferredValue被撕裂了。
升级到react-redux@8 则恢复正常。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants