menu

emotion

Emotion is a css-in-js library focused on performance and developer experience

Channels
# All channels
view-forward
# General
view-forward
# Development
view-forward
# Help
view-forward
# Off Topic
view-forward
Team

Is there a way to disable themeing altogether?

July 10, 2020 at 1:01pm

Is there a way to disable themeing altogether?

July 10, 2020 at 1:01pm
I'm looking for a way to completely avoid the creation of theme Provider and Consumer components in my app. Most of my theme is static and can be consumed by exporting the functions that reference it from a factory function in which theme is in scope. The dynamic aspects of theming I can handle through CSS custom properties. Is there a configuration option I can use, to avoid the theme mechanism?

July 10, 2020 at 9:33pm
Looking at the docs (https://emotion.sh/docs/theming), theming looks like an entirely opt-in feature. What is the problem you're trying to solve?
  • reply
  • like

July 11, 2020 at 9:22am
I'm trying to avoid the "over subscription" problem, where every component in a large DOM is wrapped in a theme Context.Consumer even if it doesn't need to access it. I've seen slow hydration times in the styled-components version of this, and there have been recent articles about the performance cost. However I asked this in the repo and got the following explanation concerning the upcoming v11
  • reply
  • like