I was able to do this based on the reactnet-webpack
template. In my case I was trying to include react-jsonschema-form
, but I guess it should work the same for all other React components.
- Install component
npm install -s @rjsf/core
- Import in your .jsx file where you'd like to use the component:
import Form from "@rjsf/core";
- Add component inside an existing render function:
const schema = {
title: "Todo",
type: "object",
required: ["title"],
properties: {
title: { type: "string", title: "Title", default: "A new task" },
done: { type: "boolean", title: "Done?", default: false }
}
};
const log = (type) => console.log.bind(console, type);
render() {
return (
<Form schema={schema}
onChange={log("changed")}
onSubmit={log("submitted")}
onError={log("errors")} />
);
}
}
Rebuild JS parts using Webpack: npm run build
Start app in Visual Studio