Вот код
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import Form from "@rjsf/core";
import axios from 'axios';
//Form = JSONSchemaForm.default;
const onSubmit = ({ formData }) => console.log("Data submitted: ", formData);
state = {
scheme: []
}
const scheme = axios.get(`http://localhost/lk-ssl/hs/json/new_student`.json)
.then(res => {
const schema= res.data;
console.log(schema);
this.setState({ scheme});
return scheme;
})
ReactDOM.render((
<Form schema={schema}
onSubmit={onSubmit}/>),
document.getElementById('app')
);
Как результат get-запроса сохранить и передать для рендера в ReactDOM.render? Сейчас выходить ошибка
Failed to compile
./src/index.js
Line 13:3: 'state' is not defined no-undef
Line 29:19: 'schema' is not defined no-undef
Search for the keywords to learn more about each error.