---
title: Load Survey from SurveyJS Demo Service
product: Survey Creator
description: Learn how to load survey JSON schemas from SurveyJS Demo Service. View a free demo example for JavaScript to learn more.
framework: React
source: https://surveyjs.io/survey-creator/examples/load-survey-json-from-service/reactjs
index: https://surveyjs.io/survey-creator/examples/overview.md
---

# Load Survey from SurveyJS Demo Service (React)

## Files

### `public/index.html`

```html
<link href="https://fonts.googleapis.com/css?family=Open%20Sans:400,600&display=swap" rel="stylesheet">
<!-- Uncomment the following lines to enable Ace Editor in the JSON Editor tab -->
<!-- 
<script src="https://unpkg.com/ace-builds/src-min-noconflict/ace.js"></script>
<script src="https://unpkg.com/ace-builds/src-min-noconflict/ext-searchbox.js"></script>
<script src="https://unpkg.com/ace-builds/src-min-noconflict/theme-clouds_midnight.js"></script>
-->

<div id="surveyCreatorContainer" style="position: absolute; height: 100%; width: 100%"></div>
```

### `src/service.js`

```js
export function loadSurvey(creator, surveyId) {
    const surveyServiceUrl = "https://api.surveyjs.io/public/v1/Survey";
    fetch(surveyServiceUrl + "/getSurvey?surveyId=" + surveyId)
        .then(response => {
            if (response.ok) {
                return response.json();
            }
            throw new Error("Could not load the survey JSON schema");
        })
        .then(data => {
            creator.JSON = data;
        })
        .catch(error => console.log(error));
}
```

### `src/SurveyCreatorComponent.jsx`

```js
import React from "react";
import { SurveyCreator, SurveyCreatorComponent } from "survey-creator-react";
import "survey-core/survey.i18n";
import "survey-creator-core/survey-creator-core.i18n";
import { loadSurvey } from "./service";
import "survey-core/survey-core.css";
import "survey-creator-core/survey-creator-core.css";
import "./index.css";

import SurveyTheme from "survey-core/themes";
import { registerCreatorTheme } from "survey-creator-core";

registerCreatorTheme(SurveyTheme); // Add predefined Survey Creator UI themes

function SurveyCreatorRenderComponent() {
    const creator = new SurveyCreator();
    loadSurvey(creator, "d5220f76-4802-40cf-ad67-61d7e55608e5");
    return (<SurveyCreatorComponent creator={creator} />);
}

export default SurveyCreatorRenderComponent;
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import React from "react";
import { createRoot } from "react-dom/client";
import SurveyCreatorRenderComponent from "./SurveyCreatorComponent";

const root = createRoot(document.getElementById("surveyCreatorContainer"));
root.render(<SurveyCreatorRenderComponent />);
```

### `package.json`

```json
{
  "dependencies": {
    "react": "latest",
    "react-dom": "latest",
    "survey-core": "latest",
    "survey-react-ui": "latest",
    "survey-creator-core": "latest",
    "survey-creator-react": "latest"
  },
  "devDependencies": {
    "react-scripts": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/survey-creator/examples/load-survey-json-from-service/angular.md)
- [Vue 3](https://surveyjs.io/survey-creator/examples/load-survey-json-from-service/vue3js.md)
- [jQuery](https://surveyjs.io/survey-creator/examples/load-survey-json-from-service/jquery.md)
- [Vanilla JS](https://surveyjs.io/survey-creator/examples/load-survey-json-from-service/vanillajs.md)
