我尝试了很多,但我的项目不使用纱线运行,虽然已经工作(使用 create-react-app 制作)。
我尝试过:yarn install- npm install --global yarn- npm update --global yarn- yarn version apply等等。
当我跑步yarn start时:
Edit1:当我创建一个新项目(使用create-react-app)时,不会发生任何错误。它仅对以前的项目给出错误。
我已经yarn install为这些目录做了工作,并且yarn start工作了。所以运行yarn install并不能解决这个问题。虽然当我run install再次运行时,它给出了这个错误:
Edit2:当我删除node_modulesand.yarn和yarn.lock,然后运行yarn installand then 时yarn start,它给出了另一个错误:
我尝试更改以下代码。我将 LabelText 样式中的“&&”更改为“&”。但我不知道,例如,为什么检查输入(Arman)时输出中的第一个标签是“蓝色”。而预计它会是“红色”。也许,因为我不知道单 & 符号和双 & 符号('&&' v &')之间的区别。
在styled-components 文档中,“&”指的是组件的所有实例,“&&”指的是组件的一个实例。
这些之间到底有什么区别?
代码:
const Arman = styled.input.attrs({ type: "checkbox" })``;
const Label = styled.label`
align-items: center;
display: flex;
gap: 8px;
margin-bottom: 8px;
`
const LabelText = styled.span`
${(props) => {
switch (props.$mode) {
case "dark":
return css`
background-color: black;
color: white;
${Arman}:checked + & {
color: blue;
}
`;
default:
return css`
background-color: white;
color: black;
${Arman}:checked + & {
color: red;
} …Run Code Online (Sandbox Code Playgroud) 我的项目支持分析器。但是当我开始录制然后停止时,它会说:No profiling data has been recorded.我用 creat-react-app 制作了我的项目。
我如何观察我的应用程序的活动以及遗漏了什么?