OpenRPC documentation as a react component
This is a react component that will render documentation for a given OpenRPC document.
Screenshot:
npm install --save @open-rpc/docs-react
import Documentation from "@open-rpc/docs-react";
and then use it somewhere:
<Documentation schema={schema} />
npx create-react-app <appname> --typescript
cd <appname>
npm install .
npm install @open-rpc/docs-react @open-rpc/meta-schema --save
import React from 'react';
import ReactDOM from 'react-dom';
import Documentation from "@open-rpc/docs-react";
import { OpenrpcDocument } from '@open-rpc/meta-schema';
const schema: OpenrpcDocument = {
openrpc: "1.2.4",
info: {
"version": "0.0.0-development",
"title": "My New API"
},
methods: []
};
ReactDOM.render(<Documentation schema={schema} />, document.getElementById("root"));