Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何在react中使用react jsonschema表单?_Reactjs_React Jsonschema Forms - Fatal编程技术网

Reactjs 如何在react中使用react jsonschema表单?

Reactjs 如何在react中使用react jsonschema表单?,reactjs,react-jsonschema-forms,Reactjs,React Jsonschema Forms,我在react with json中构建表单时遇到问题。我已经安装了react jsonschema表单,但无法使其正常工作。我在本地安装了这个包,我使用的是TypeScript,我使用的是nx/nrwl。这就是我尝试过的 import React from 'react'; import './form.scss'; const Form = JSONSchemaForm.default; const schema = { type: "string" }; /* eslint-d

我在react with json中构建表单时遇到问题。我已经安装了react jsonschema表单,但无法使其正常工作。我在本地安装了这个包,我使用的是TypeScript,我使用的是nx/nrwl。这就是我尝试过的

import React from 'react';
import './form.scss';

const Form = JSONSchemaForm.default;
const schema = {
    type: "string"
};

/* eslint-disable-next-line */
export interface FormProps {
    json: any;
}


export const FormComponent = (props: FormProps) => {
        return (
            <>
                <Form schema={schema}/>
            </>
        );
    }
;

export default FormComponent;
从“React”导入React;
导入“./form.scss”;
const Form=JSONSchemaForm.default;
常量模式={
类型:“字符串”
};
/*eslint禁用下一行*/
导出接口FormProps{
json:任何;
}
导出常量FormComponent=(道具:FormProps)=>{
返回(
);
}
;
导出默认表单组件;
问题是从哪里获取JSONSchemaForm变量

例如,这个小片段就像一个符咒


谢谢你的建议

JSONSchemaForm是加载到web应用程序中的导出的名称,如果您使用

既然您说您安装了该软件包,那么您只需使用导入语法(即从“@rjsf/core””导入表单),并让您的捆绑程序处理库依赖关系,而不是修改您的
index.html
,以包含CDN脚本