MCPcopy Create free account
hub / github.com/codesandbox/sandpack / getTranspiledCode

Function getTranspiledCode

sandpack-react/src/hooks/useTranspiledCode.ts:5–13  ·  view source on GitHub ↗
(sandpack: SandpackState)

Source from the content-addressed store, hash-verified

3import { useSandpack } from "./useSandpack";
4
5function getTranspiledCode(sandpack: SandpackState): string | null {
6 const { activeFile, bundlerState } = sandpack;
7 if (bundlerState == null) {
8 return null;
9 }
10
11 const tModule = bundlerState.transpiledModules[activeFile + ":"];
12 return tModule?.source?.compiledCode ?? null;
13}
14
15/**
16 * @category Hooks

Callers 1

useTranspiledCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected