Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kolyasya/react-meteor-method-hooks

Simple hook to handle Meteor.call requests. Loading, Error and Result state
https://github.com/kolyasya/react-meteor-method-hooks

hooks hooks-api-react meteor react

Last synced: 3 days ago
JSON representation

Simple hook to handle Meteor.call requests. Loading, Error and Result state

Awesome Lists containing this project

README

        

# react-meteor-method-hooks

Simple hook to handle `Meteor.call` requests.

Usage example:

```javascript
import React from 'react';
import { useMeteorCall } from 'react-meteor-method-hooks';

const MyComponent = () => {

const [
calculateSomething,
calculateSomethingLoading,
calculateSomethingError,
calculateSomethingResult
] = useMeteorCall(
'calculateSomethingMethodName',
{},
(error, result) => {
if (error) {
alert(error.reason);
} else {
console.log(result);
}
},
);

return (

Calculate

{calculateSomethingError}

{calculateSomethingResult}

)
}
```