
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
@teamleader/react-hooks-api
Advanced tools
React hooks for the Teamleader API
yarn add @teamleader/react-hooks-api
or
npm install --save @teamleader/react-hooks-api
Provider
component and provide an initialized @teamleader/api config.import React from 'react';
import { Provider } from '@teamleader/react-hooks-api';
import { API as initializeAPI } from '@teamleader/api';
import App from '../App';
const API = initializeAPI({...})
const Root = () => {
return (
<Provider api={API}>
<App />
</Provider>
);
}
export default Root;
useQuery
in your components to fetch data.import React from 'react';
import { useQuery } from '@teamleader/react-hooks-api';
const QUERY = () => ({
domain: 'projects',
action: 'list',
});
const Component = () => {
const { loading, error, data } = useQuery(QUERY);
if (loading || !data) {
return 'Loading...';
}
if (error) {
return 'Error';
}
if (data) {
return data;
}
// default
return null;
};
export default Root;
useQuery
Signature: (query: Query, variables: Variables, options: Options) => QueryValues
Query
A function that returns an object. This function can be defined with variables when you need to update it dynamically.
Variables
The variables to be passed to the Query. When updated, it will re-run the query.
QueryValues
loading: Boolean
error?: Error
data?: Response
Options
{
ignoreCache: boolean; // default: false
}
[0.0.4] - 2019-07-11
FAQs
React hooks for the Teamleader API
The npm package @teamleader/react-hooks-api receives a total of 1 weekly downloads. As such, @teamleader/react-hooks-api popularity was classified as not popular.
We found that @teamleader/react-hooks-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.