Skip to main content

Function: registerPathExpr()

registerPathExpr(path): string

Defined in: packages/codegen/src/templates.ts:162

Produce the correct register(...) call expression for a field path. Uses template-literal syntax when the path contains ${ (e.g. array item paths), and single-quoted string syntax otherwise.

Parameters

path

string

The field path string (e.g. "name", "items.${index}.value").

Returns

string

A register('...') or register(\...`)` expression string for inclusion in JSX.

Examples

registerPathExpr('name')"register('name')"
registerPathExpr('items.${index}.name')"register(`items.${index}.name`)"