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

360
Vistas
How i can use react hooks with native SSR (without NextJS)?

I make custom SSR (nodeJS, ReactJS, Webpack) and i have trouble with React hooks.
When i try use hooks for example useState (her secound arguments), i'll get error "setGreetingsBlockData is not a function" on server console.

// Code from component
const { greetingsBlockData, setGreetingsBlockData } = useState({})

useEffect(() => {
    fetch(
        `https://adventuretimeapi.herokuapp.com/people`,
        { method: "GET" }
    )
        .then(res => res.json())
        .then(data => setGreetingsBlockData(data))
}, [])

setGreetingsBlockData({test: 1})

How i can fix it?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

useState returns an array, not an object

const [ greetingsBlockData, setGreetingsBlockData ] = useState({})
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