TypeError dispatcher.useState is not a function when using React Hooks

前端 未结 7 735
失恋的感觉
失恋的感觉 2020-12-06 09:04

I have this component:

import React, { useState, useEffect } from \"react\";
import ReactDOM from \"react-dom\";

function App() {
  const [count, setCount]          


        
7条回答
  •  伪装坚强ぢ
    2020-12-06 09:29

    Fixed mine by calling React.useState(0).

    If a react version is new enough, it just has to use React.useState.

提交回复
热议问题