View Sourceimport { useCompiledCode } from 'hooks'

useCompiledCode

Uses SWC to compile a string of TypeScript code at runtime.

Examples

import { CompiledComponent } from 'components'
import { useCompiledCode } from 'hooks'

export default function Example() {
  const compiledCodeString = useCompiledCode('export default () => <div>Hello World</div>')
  return <CompiledComponent codeString={compiledCodeString} />
}