在向我的主页添加轮播时,我遇到了一个问题。我收到错误:
“JSX”未定义。
我一直在查看 Stack Overflow、GitHub 以及 Google,它们都给出了相对接近的答案,但我不确定我可能做错了什么。
我的carousel.tsx文件如下
import * as React from "react";
import styled from "styled-components";
const SCarouselWrapper = styled.div`
display: flex;
`;
interface IProps {
children: JSX.Element[];
}
const Carousel = ({ children }: IProps) => {
const activeSlide = children.map(slide => (
<>
{slide}
</>
));
return (
<div>
<SCarouselWrapper>
{activeSlide}
</SCarouselWrapper>
</div>
);
};
export default Carousel;
Run Code Online (Sandbox Code Playgroud)
我的幻灯片的结构完全相同:
import * as React from "react";
import styled from "styled-components";
const SContainer = styled.div`
align-items: …Run Code Online (Sandbox Code Playgroud)