https://github.com/NixFey/react-jsonrpc-client
A JSON Rpc client for React that uses promises to call to JSON Rpc APIs.
https://github.com/NixFey/react-jsonrpc-client
javascript json-rpc-client promise react
Last synced: 10 months ago
JSON representation
A JSON Rpc client for React that uses promises to call to JSON Rpc APIs.
- Host: GitHub
- URL: https://github.com/NixFey/react-jsonrpc-client
- Owner: NixFey
- Created: 2018-03-01T20:56:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-19T17:52:24.000Z (over 6 years ago)
- Last Synced: 2025-02-28T13:18:11.121Z (11 months ago)
- Topics: javascript, json-rpc-client, promise, react
- Language: JavaScript
- Size: 2.93 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-jsonrpc-client
A JSON Rpc client for React that uses promises to call to JSON Rpc APIs.
## Usage Example
```javascript
import JsonRpcClient from '/path/to/jsonrpcclient'
class TutoringCalendar extends Component {
componentDidMount() {
var api = new JsonRpcClient({
endpoint: 'https://url.to/api',
headers: {
'X-Token': this.state.token
}
})
api.request(
METHOD_NAME,
PARAM_1,
PARAM_2,
PARAM_3
).then(function(response) {
this.setState({apiResponse: response})
}.bind(this)) // End .then()
} // End componentDidMount
} // End class