Refactor editor to update better

This commit is contained in:
Gregory Schier
2023-03-10 10:39:23 -08:00
parent e9e3ba283c
commit 0b3497e5a1
15 changed files with 87 additions and 82 deletions

View File

@@ -1,10 +1,21 @@
import { useEffect, useState } from 'react';
import { useMount, useUnmount } from 'react-use';
import { ButtonLink } from '../components/ButtonLink';
import { Editor } from '../components/Editor';
import { Heading } from '../components/Heading';
import { VStack } from '../components/Stacks';
import { useWorkspaces } from '../hooks/useWorkspaces';
export function Workspaces(props: { path: string }) {
const workspaces = useWorkspaces();
const [value, setValue] = useState<string>('hello wolrd');
useUnmount(() => {
console.log('UNMOUNT WORKSPACES');
});
useMount(() => {
console.log('MOUNT WORKSPACES');
});
console.log('RENDER WORKSPACES');
return (
<VStack as="ul" className="p-12">
<Heading>Workspaces</Heading>
@@ -13,6 +24,7 @@ export function Workspaces(props: { path: string }) {
{w.name}
</ButtonLink>
))}
<Editor defaultValue={value} className="!bg-gray-50" onChange={setValue} />
</VStack>
);
}