Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda