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

133
Vistas
Call Node.js Script from React component
   const pythonProcess = spawn('python',["tiqi.py", "textFile.txt"]);
    
        pythonProcess.stdout.on('data',(data)=>{
            console.log(data.toString());
        })

Can I call and run that code by clicking a component button in my react project?

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

0

You cannot use node-based functions in a browser environment, to do such a thing in a proper way you should build an HTTP/HTTPS API for your react application and make requests from react to your API.

You can go through by googling building a simple node server based on express, and output your python script results in maybe .json file which you'll read with node (which will be sent on request from your react application).

Hope my answer will help you a bit.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Short answer: No. But other Node-based functions can be invoked using Browserify.

Refer to this link: https://github.com/browserify/browserify/issues/1816

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