Hook to get workspace instance provided to WorkspaceProvider.
useWorkspace: (workspace?: string | undefined) => string | undefined
You can set a workspace override that will be returned if defined. This makes the usage more ergonomic (see the following example).
Note: For a better TypeScript experience without the hassle of undefined values, you can use the useWorkspaceStrict hook.
// instead of const fromContext = useWorkspace(); const effectiveWorkspace = fromArguments ?? fromContext. // you can write const workspace = useWorkspace(fromArguments);