Skip to content

Commit 8f259f0

Browse files
authored
fix: write readme on how to use
fixes #9
1 parent 70dc90c commit 8f259f0

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# docs-react
2+
OpenRPC documentation as a react component
3+
4+
#### What is this?
5+
This is a react component that will render documentation for a given OpenRPC document.
6+
7+
**Screenshot**:
8+
9+
![image](https://user-images.githubusercontent.com/364566/54795109-1b1f5b80-4c08-11e9-9ba9-cc2f2d96c692.png)
10+
11+
12+
#### How do I use this?
13+
14+
##### Installation:
15+
```
16+
npm install --save @open-rpc/docs-react
17+
```
18+
##### Usage:
19+
```
20+
import Documentation from "@open-rpc/docs-react";
21+
```
22+
and then use it somewhere:
23+
24+
```
25+
<Documentation schema={schema} />
26+
```
27+
28+
##### In a new project:
29+
Here's how it would be used in a new `npm init react-app --typescript <appname>` project:
30+
```
31+
import React from "react";
32+
import ReactDOM from "react-dom";
33+
import Documentation from "@open-rpc/docs-react";
34+
35+
const schema = {
36+
"info": {
37+
"title": "My New API"
38+
}
39+
};
40+
41+
ReactDOM.render(<Documentation schema={schema} />, document.getElementById("root"));
42+
```

0 commit comments

Comments
 (0)