此代码段出现此错误。
const AB= () => {
const [A, setA] = useState<AT| null>(null);
const [B, setB] = useState<string>('0px');
..more}
答案 0 :(得分:2)
使用Pascal大小写作为组件名称,如果尚未导入,则导入react和useState。
import React, { useState } from "react";
import ReactDOM from "react-dom";
const KlageHome = () => {
const [matrikkelnummer, setMatrikkelnummer] = useState(null);
const [panelHeight, setPanelHeight] = useState('0px')
return (
<div>{panelHeight}</div>
)
}
const rootElement = document.getElementById("root");
ReactDOM.render(<KlageHome />, rootElement);