q2-tecton-hooks
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

q2-tecton-hooks

GitHub stars

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

MIT License

Nueve Solutions LLC © 2020

Changelog

Review the changelog

Contributors

/q2-tecton-hooks/

    Package Sidebar

    Install

    npm i q2-tecton-hooks

    Weekly Downloads

    42

    Version

    0.0.5

    License

    Apache-2.0

    Unpacked Size

    44.2 kB

    Total Files

    26

    Last publish

    Collaborators

    • codejamninja