gpt4 book ai didi

javascript - 使用情感设计列表元素

转载 作者:行者123 更新时间:2023-11-28 03:39:34 24 4
gpt4 key购买 nike

我正在尝试使用 emotion 设计我的 react 应用程序

我想让我的 ulli 元素成为无项目符号。

我正在关注this doc from Emotion

这是他们的例子:

import styled from '@emotion/styled'

const Child = styled.div`
color: red;
`

const Parent = styled.div`
${Child} {
color: green;
}
`
render(
<div>
<Parent>
<Child>green</Child>
</Parent>
<Child>red</Child>
</div>
)

这是我的尝试。

import React from 'react';
import styled from '@emotion/styled'

class Budget extends React.Component {
state = {
studentLoanPayment: 0,
};

handleInputChange = event => {
const { name, value } = event.target;
console.log(name, value)
this.setState({ [name]: value });
};
const Li = styled.li({
color: 'red'
})
render() {

但是,我在 const li = ... 中收到 liunexpected token 错误如何定位常见 HTML 元素,例如 ulliplabel

最佳答案

您的语法不正确,应该是:

const Li = styled.li`
color: red;
`

关于javascript - 使用情感设计列表元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57402448/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com