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

前端 未结 7 722
失恋的感觉
失恋的感觉 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 ^.

    0 讨论(0)
提交回复
热议问题