Question T9245
Visible to All Users

Understand library difference: survey-react vs. survey-core

created 4 years ago

Hi, I get little confused about different library.

When we are building creator using survey-creator-react, it looks like if I try to add custom widget and do import like this
import {CustomWidgetCollection} from 'survey-react', it wont work.
If I import {CustomWidgetCollection} from 'survey-core', then it works.

What's the difference between this 2 libraries?
when we build creator website, which library I should use to register custom properties and widgets?
when we build single page that hosts a survey (const model = new Model(json)), which library I should use to add custom properties and widgets?

Framework: React

Answers approved by surveyjs Support

created 4 years ago

Hello,
We used to have "survey-react". Now we have additional packages: "survey-core" and "survey-react-ui". In fact "survey-react" is a bundle for "survey-core" and "survey-react-ui".
survey-react = survey-core + survey-react-ui + survey-core/i18n. The last is the localized strings.

Thank you,
Andrew
SurveyJS Team

    Comments (3)

      so do you recommend to use survey-react?

      Code
      When we are building creator using survey-creator-react, it looks like if I try to add custom widget and do import like this import {CustomWidgetCollection} from 'survey-react', it wont work. If I import {CustomWidgetCollection} from 'survey-core', then it works.

      I feel like import from "survey-react' doesnt work because 'survey-creator-react' is import something from 'survey-core' library. But 'survey-react' doesnt act like that, it has own core function inside the library.

        Since you are using Creator V2 for React, then it is better to remove "survey-react".
        "survey-creator-react" will install survey-creator-core, survey-core and survey-react-ui. You don't need "survey-react".
        survey-core is survey model and survey-react-ui is survey rendering in react that depends on survey-core.
        We stopped using survey-react in our examples and started to use survey-core + survey-react-ui.

        Thank you,
        Andrew
        SurveyJS Team

          thanks for clarification!