Skip to main content
Version: 0.24

Function: ref()

ref(_descriptor): RefObject

Creates a fallback reference object for a value from your app.

Use reference imports when passing values from your app into the Wasp spec. If a direct import is not practical, use ref as a fallback.

Reference imports are preferred because editors can follow and rename real imports.

The import path must be relative to the *.wasp.ts file where it is used and resolve inside the app's src/ directory. Absolute paths are not supported.

Parametersโ€‹

_descriptorโ€‹

RefObjectDescriptor

Returnsโ€‹

RefObject

Exampleโ€‹

import { page, ref } from "@wasp.sh/spec"

const MainPage = ref({
importDefault: "MainPage",
from: "./src/MainPage",
})

export const mainPage = page(MainPage)