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

🧐[问题] ReactDOM.createRoot 中theme的上下文问题 #176

Open
shanhexi opened this issue Nov 6, 2024 · 1 comment
Open

🧐[问题] ReactDOM.createRoot 中theme的上下文问题 #176

shanhexi opened this issue Nov 6, 2024 · 1 comment

Comments

@shanhexi
Copy link

shanhexi commented Nov 6, 2024

🧐 问题描述

有的情况下我需要通过ReactDOM.createRoot去渲染一些react组件,这样的话,在这个react组件里就拿不到theme的上下文了,这个有什么好的解决办法,

现在我的尝试

  1. 在store里存一份theme的值,但这样需要重写覆盖antd的样式
  2. 使用包裹这个组件,但是这样渲染的时长会从20ms增加到200ms

这两个一个性能问题,一个比较麻烦

image
@shanhexi shanhexi changed the title 🧐[问题] 🧐[问题] ReactDOM.createRoot 中theme的上下文问题 Nov 6, 2024
@arvinxx
Copy link
Collaborator

arvinxx commented Nov 6, 2024

render 外层包一个 ThemeProvider 然后把 theme 注入呢?

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

No branches or pull requests

2 participants