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

前端 未结 7 729
失恋的感觉
失恋的感觉 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:42

    Now that react 16.7 (the one not containing hooks) is released you might get an error if you type ^16.7.0-alpha.0 with the leading ^ in your package.json.

    For the version with hooks you have to omit the ^.

提交回复
热议问题