mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
useFiretable setup
This commit is contained in:
21
src/hooks/useFiretable.ts
Normal file
21
src/hooks/useFiretable.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
//TODO: consolidate useTable, useTableConfig, useCell into useFiretable
|
||||
|
||||
import { useEffect } from "react";
|
||||
import useTable from "./useTable";
|
||||
import useTableConfig from "./useTable";
|
||||
import useCell from "./useCell";
|
||||
|
||||
const useFiretable = (collectionName: string) => {
|
||||
const [tableConfig, configActions] = useTableConfig(collectionName);
|
||||
const [table, tableActions] = useTable({
|
||||
path: collectionName
|
||||
});
|
||||
const setTable = (collectionName: string) => {
|
||||
configActions.setTable(collectionName);
|
||||
tableActions.setTable(collectionName);
|
||||
};
|
||||
const actions = { setTable: tableActions.setTable };
|
||||
return [table, actions];
|
||||
};
|
||||
|
||||
export default useFiretable;
|
||||
Reference in New Issue
Block a user