mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Add useProjectsManager hook
This commit is contained in:
1 parent
1135821195
commit
17162b3af0
5 files changed
+29
-16
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { useMemo } from 'react';
|
||||
import { ProjectsManager } from '@/lib/fs';
|
||||
import { useFS } from '@/hooks/useFS';
|
||||
|
||||
/**
|
||||
* Hook that provides a ProjectsManager instance.
|
||||
* The ProjectsManager is memoized based on the fs instance.
|
||||
*/
|
||||
export function useProjectsManager() {
|
||||
const { fs } = useFS();
|
||||
|
||||
const projectsManager = useMemo(() => new ProjectsManager(fs), [fs]);
|
||||
|
||||
return projectsManager;
|
||||
}
|
||||
Reference in new issue
Block a user