Skip to content

Commit 2b0b5cb

Browse files
authored
Creates README.md
1 parent cd5b0cb commit 2b0b5cb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# react-jsonrpc-client
2+
A JSON Rpc client for React that uses promises to call to JSON Rpc APIs.
3+
4+
## Usage Example
5+
```javascript
6+
import JsonRpcClient from '/path/to/jsonrpcclient'
7+
class TutoringCalendar extends Component {
8+
componentDidMount() {
9+
var api = new JsonRpcClient({
10+
endpoint: 'https://url.to/api',
11+
headers: {
12+
'X-Token': this.state.token
13+
}
14+
})
15+
api.request(
16+
METHOD_NAME,
17+
PARAM_1,
18+
PARAM_2,
19+
PARAM_3
20+
).then(function(response) {
21+
this.setState({apiResponse: response})
22+
}.bind(this)
23+
}
24+
25+
}

0 commit comments

Comments
 (0)