q2-tecton-hooks
v0.0.5
Published
react hooks for the q2 tecton sdk
Downloads
1,055
Maintainers
Readme
q2-tecton-hooks
react hooks for the q2 tecton sdk
Please ★ this repo if you found it useful ★ ★ ★
Installation
npm install --save q2-tecton-sdk q2-tecton-hooks
Usage
index.tsx
import { render } from 'react-dom';
import { TectonProvider } from 'q2-tecton-hooks';
import App from './App';
render(
<TectonProvider>
<App />
</TectonProvider>,
document.getElementById('app')
);
App.tsx
import React, { FC } from 'react';
import { useTecton } from 'q2-tecton-hooks';
export interface AppProps {}
const App: FC<AppProps> = (props: AppProps) => {
const tecton = useTecton();
console.log(tecton);
return <div>{tecton ? JSON.stringify(Object.keys(tecton)) : ''}</div>;
};
export default App;
Fetching Prop
Instead of using tecton?.actions?.setFetching(false)
, the fetching prop can be used
to control fetching. If the fetching prop is not set, fetching will be set to false
when tecton has loaded.
The following example will prevent fetching from automatically being set to false
. Once
the prop is set to false
, fetching will be set to false
.
index.tsx
import { render } from 'react-dom';
import { TectonProvider } from 'q2-tecton-hooks';
import App from './App';
render(
<TectonProvider fetching>
<App />
</TectonProvider>,
document.getElementById('app')
);
Hooks
| Hook | Description |
| ------------ | --------------- |
| useTecton
| core tecton api |
| useActions
| tecton actions |
| useSources
| tecton sources |
Support
Submit an issue
Contributing
Review the guidelines for contributing
License
Nueve Solutions LLC © 2020
Changelog
Review the changelog
Contributors
- Jam Risser - Author