我正在尝试使用自定义组件创建样式指南。我需要能够在彼此内部插入组件,但不确定如何在 .md 文件中执行此操作。我有一个列表和列表项。我想在列表中显示列表项。在 styleguidist 显示中出现此错误。这里有一些很好的例子,但没有一个能说明我想要完成的事情——https: //github.com/styleguidist/react-styleguidist/tree/master/examples/basic/src/components
SyntaxError: Unexpected token (3:0) 1: import ListItem from './ListItem' 2: 3:
列表.tsx
import React, { Component } from 'react'
import './List.css'
export interface IListProps {
/** Type of button to display */
font: string;
disabled: boolean;
mtmClass: string;
link: boolean;
}
class List extends Component<IListProps> {
render() {
const { children } = this.props
return <ul className={'mtm-list'}>{children}</ul>
}
}
export default List
列表.md
```js
import ListItem from './ListItem'
<List>
<ListItem>
Content in a List
</ListItem>
</List>
列表项.tsx
import React, { Component } from 'react'
import './List.css'
export interface IListItemProps {
/** Type of button to display */
font: string;
disabled: boolean;
mtmClass: string;
link: boolean;
}
class ListItem extends Component<IListItemProps> {
render() {
const { children } = this.props
return <li className={'mtm-list-item'}>{children}</li>
}
}
export default ListItem