@codecraftkit
Documentation
Hooks is package that has a bundle of useful hooks to use in the project.
npm install @codecraftkit/hooks
npm i @apollo/client graphql moment react-translate
Some components their own standalone package
The useDataTable is a hook that is used to manage the DataTable along with the Paginate and a custom filter.
const [dataTable, paginate, filter, { refreshList }] = useDataTable(useDataTableProps);
This is a hooks use to mutate Data from graphql, it use the useMutation hook from @apollo/client
const [data, call, loading, error] = useGqlMutation(QUERY);
This is a hooks use to get Data from graphql, it use the useQuery hook from r@apollo/client
const [data, call, loading, error] = useGqlQueryRequest('collection', QUERY);
This is a hooks use to get Data from any api
const {data, call, loading, error} = useApiRequest(api, 'path');
This is a hooks use to get Data from comet
const {data, call, loading, error} = useCometRequest('path');
This is a hooks to manage translation, it uses react-translate, the language context must be set in order to work
const translate = useTranslate()
This is a hooks used with the FormField Type a head
const [call, loading] = useTypeAHead({path: 'path',customSend: search => ({number: search})})
useDataTable
useGqlMutation
useGqlQueryRequest
useApiRequest
useCometRequest
useTranslate
useTypeAHead