小编Muh*_*dan的帖子

在react-select中使用深色模式

我认为改变颜色的最好方法是使用主题道具或在文档中看起来像这样:


import { flavourOptions } from '../data';
import Select from 'react-select';

export default () => (
  <Select
    defaultValue={flavourOptions[2]}
    label="Single select"
    options={flavourOptions}
    theme={theme => ({
      ...theme,
      borderRadius: 0,
      colors: {
        ...theme.colors,
        primary25: 'hotpink',
        primary: 'black',
      },
    })}
  />
);
Run Code Online (Sandbox Code Playgroud)

但是,我并没有被困在弄清楚如何“连接”它的黑暗模式切换上。

javascript reactjs react-select

7
推荐指数
2
解决办法
8527
查看次数

javascript中if语句中的多个条件

我知道有这样的问题,但我的有点不同,它已经有效,但我不知道如何简化它。

if (location.pathname === `/` || location.pathname ===`/kurikulum/` || location.pathname === `/pengembangan-diri/` || location.pathname === `/statistik/` || location.pathname === `/teknologi/` || location.pathname === `/ekonomi/` || location.pathname === `/desain/` || location.pathname === `/corona/`)

正如你所看到的,它并不漂亮,我想知道我们可以不重复 location.pathname吗?

这是在 gatsby 上,但这是一个 javascript 问题

javascript

2
推荐指数
1
解决办法
94
查看次数

标签 统计

javascript ×2

react-select ×1

reactjs ×1