小编Aki*_*uda的帖子

我不能在 Create React App + node-sass setup 的 sass 文件中使用 @use

在我的src/styles/variables.scss文件中,我已经$primary-color: #171b42;定义了。

我想在我的src/components/LandingPage/LandingPage.module.scss文件中使用这个变量。

在这个文件中,我有:

@use "../../styles/variables.scss" as v;

$color: v.$primary-color;

.heading {
  color: $color;
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

SassError: Invalid CSS after "$color: v": expected expression (e.g. 1px, bold), was ".$primary-color;"

我究竟做错了什么?我已经node-sass安装

sass reactjs node-sass

3
推荐指数
2
解决办法
803
查看次数

使用 Next.js 无需重新加载页面即可更改路线

每当用户单击继续按钮时,就会触发一个函数,在该函数中,我调用:

push("/signup/page-2", undefined, { shallow: true });

所有看起来像/signup/[page].js这样的动态路由都会返回<Component />

我也有一个/signup/index.js返回<Component />

问题是:

每次push("/signup/page-2", undefined, { shallow: true });调用页面都会重新加载并清除所有状态。

还值得一提的是,这个应用程序是一个带有 react-router-dom 应用程序的 CRA,它被转换为 next.js 应用程序

javascript reactjs next.js

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

标签 统计

reactjs ×2

javascript ×1

next.js ×1

node-sass ×1

sass ×1