有这么简单的
React
应用程序:
import React, { useState, useEffect, useRef } from "react";
import ReactDOM from 'react-dom'
function App() {
const [inputValue, setInputValue] = useState("");
const count = useRef(0);
useEffect(() => {
count.current = count.current + 1;
});
return (
<>
<input
type="text"
//value={inputValue}
//onChange={(e) => setInputValue(e.target.value)}
/>
<h1>Render Count: {count.current}</h1>
</>
);
}
const rootElement=document。getElementById('root')
反应状态。渲染(,根元素)
我发现了一些错误:
(0,_react.useState)不是函数(0,_react.useRef)不是
作用
我做错了什么?