【发布时间】:2019-02-26 08:10:49
【问题描述】:
如何在 preact 中创建上下文?
在反应中喜欢https://reactjs.org/docs/context.html#reactcreatecontext
【问题讨论】:
标签: preact
如何在 preact 中创建上下文?
在反应中喜欢https://reactjs.org/docs/context.html#reactcreatecontext
【问题讨论】:
标签: preact
Preact 支持开箱即用的 legacy context API,但对新的稳定上下文 API 的支持仍在进行中 - 在他们的 GitHub 上打开了一个 pull request 来跟踪这一点。
与此同时,您可以选择使用旧 API 或使用新 API 的第三方实现,例如 preact-context。
【讨论】:
createContext-API 将包含在我们的下一个主要版本中。 Alpha 版计划于 2019 年 3 月 4 日发布。免责声明:我在 preact 上工作。