Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
TypeError: react_1.useEffect is not a function

I am trying to make us of useEffect in my React component but I am encountering an issue with the following error:

TypeError: react_1.useEffect is not a function

and

Uncaught (in promise) TypeError: react_1.useState is not a function

I have imported the libraries like this

import React, { useEffect } from 'react'

and have the useEffect like this:

useEffect(() => {
  console.log("This is cool")
}, [intentButton])

The react version is 16.7.0

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

this is because the react V16.7 does not have hooks

The resolution is to downgrade to

   npm i react@next react-dom@next 

which as of 2018/12/20 is 16.7.0-alpha.2:

yarn add react@next react-dom@next

then lose the test renderer:

 import React from 'react'
 import ReactDOM from 'react-dom'
 import App from './App'
 it('renders without crashing', () => {
    const div = document.createElement('div')
    ReactDOM.render(<App />, div)
    ReactDOM.unmountComponentAtNode(div)
 })

This is what package.json should be:

  "react": "^16.7.0-alpha.2",
  "react-dom": "^16.7.0-alpha.2",
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!