useWorkspaceStrict
Home > @gooddata/sdk-ui > useWorkspaceStrict
useWorkspaceStrict variable
Hook to get workspace instance provided to WorkspaceProvider.
Signature:
useWorkspaceStrict: (workspace?: string, context?: string) => string
Remarks
You can set a workspace override that will be returned if defined. This makes the usage more ergonomic (see the following example).
Note: Note: If you do not provide a workspace identifier to WorkspaceProvider or as a parameter for this hook, an invariant error is raised.
Example
// instead of
const fromContext = useWorkspaceStrict();
const effectiveWorkspace = fromArguments ?? fromContext.
// you can write
const workspace = useWorkspaceStrict(fromArguments);