Pre or Post Incrementing React state with ++ throws read only error

前端 未结 0 1552
暖寄归人
暖寄归人 2020-12-29 02:44
import React, {useState} from \'react\';

function App(){
  const [counter, setCounter] = useState(0);

  const onIncrement = () => {
      setCounter(++counter)
         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题