首页 > 解决方案 > 仅由 react-select 使用的@emotion 问题

问题描述

我们使用 react-select 4.3.1,它使用 @emotion 作为样式。不幸的是,我在启动我的反应应用程序时出错:

类型错误:选项未定义 createCache c:/dev/myapp/client/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js:178

  175 | var defaultStylisPlugins = [prefixer];
  176 | 
  177 | var createCache = function createCache(options) {
 178 |   var key = options.key;
  179 | 
  180 |   if (process.env.NODE_ENV !== 'production' && !key) {
  181 |     throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");

我们不直接使用@emotion。知道如何解决这个问题吗?

标签: javascriptreactjstypescriptreact-select

解决方案


推荐阅读