Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/kolyasya/react-meteor-method-hooks
- Owner: kolyasya
- Created: 2021-09-26T09:32:07.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-28T22:51:27.000Z (6 months ago)
- Last Synced: 2024-05-29T12:36:34.962Z (6 months ago)
- Topics: hooks, hooks-api-react, meteor, react
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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}
)
}
```