Question T6015
Visible to All Users

Creating survey with JSON and Code in react

created 4 years ago

Hi,

I am following through the documentation from https://surveyjs.io/Documentation/Library to create a survey with combination of JSON and code in a react app.

I added the the below line in the react component code as a starter but it is throwing an exception. Is the dynamic creation of question with code supported in the react version? If yes, is there a sample code that can be provided.

JavaScript
var survey = new Survey.Survey(json);
Code
reactSurvey.tsx:365 Uncaught TypeError: Cannot set property 'renderCallback' of undefined at Survey.setSurveyEvents (reactSurvey.tsx:365) at Survey.createSurvey (reactSurvey.tsx:329) at new Survey (reactSurvey.tsx:27)

Thanks in advance.

Answers approved by surveyjs Support

created 4 years ago

Hello,

You can check any live example for React on our site - https://surveyjs.io/Examples/Library?id=questiontype-text&platform=Reactjs&theme=modern or open any example in plunker - https://plnkr.co/edit/Z49jzc44NpEtj6I1

Thanks, Serge
SurveyJS Team

    Show previous comments (1)

      Hello,
      Here is the example.

      Thank you,
      Andrew
      SurveyJS Team

        Thank you! The example worked :-)

          You are welcome!

          Andrew
          SurveyJS Team