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

152
Vistas
`survey-react` da un error con `this.addEvent`

Heredé un proyecto de reacción y no puedo descifrar cómo usar el módulo survey-react . Sigo recibiendo este error en http://localhost:3000/

 Uncaught TypeError: this.addEvent is not a function node_modules/survey-react/survey.react.js:2582 2579 | * options.newValue - new value. 2580 | */ 2581 | > 2582 | this.onPropertyChanged = this.addEvent(); | ^ 2583 | /** 2584 | * Event that raised on changing property of the ItemValue object. 2585 | * sender - the object that owns the property

Simplifiqué mi proyecto a solo 3 archivos, que son:

Este es mi src/index.js .

 import React from 'react'; import ReactDOM from 'react-dom'; import * as Survey from 'survey-react'; const questions = { elements:[{"type":"comment","name":"If you could enhance one thing about this product, what would it be?","isRequired":true}] }; const srv = Survey.Model(questions); srv.data = {"If you could enhance one thing about this product, what would it be?":"I like it as is, no changes needed."}; ReactDOM.render(<Survey.Survey model={srv} />, document.getElementById('root'));

Este es mi package.json

 { "name": "testingthis", "version": "0.1.0", "private": true, "dependencies": { "babel-jest": "^23.6.0", "react": "^16.6.1", "react-dom": "^16.4.2", "react-scripts": "^2.1.8", "survey-react": "1.9.33" }, "scripts": { "start": "react-scripts start" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] }

Este es mi public/index.html

 <!DOCTYPE html> <html lang="en"> <body> <div id="root"></div> </body> </html

¿Qué estoy haciendo mal?

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

0

No puedo encontrar ninguna documentación sobre el paquete Survey-React, pero los documentos oficiales en el sitio de SurveyJS dicen que debe usar los paquetes Survey -Core y Survey-React - UI ( https://surveyjs.io/Documentation/Library? id=comenzar-reaccionar ):

 import { StylesManager, Model } from "survey-core"; import { Survey } from "survey-react-ui";

Entonces, cambie a esos, o si insiste en usar encuesta-reaccionar , puede hacer que funcione cambiando su código de esta manera:

 import React from "react"; import ReactDOM from "react-dom"; import * as Survey from "survey-react"; const questions = { elements: [ { type: "comment", name: "If you could enhance one thing about this product, what would it be?", isRequired: true } ] }; const data = { "If you could enhance one thing about this product, what would it be?": "I like it as is, no changes needed." } ReactDOM.render(<Survey.Survey json={questions} data={data} />, document.getElementById("root"));
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