Load and register classic template token handler for the JSX template. After loading the handler, its tokens can be used in the JSX template
Usage: (This is a JSX tag, don't call the function directly.)
<RegisterTokenIds name="handler1" handler={() => {...}}
<RegisterTokenIds handler="./token-handlers" />
"."
name
Example:
import { IndexPage, Token, RegisterTokenIds } from "@xarc/jsx-renderer"export const Template = () => (<IndexPage> <RegisterTokenIds name="handler1" handler={setupContext => { return { TOKEN1: context => { return "result from TOKEN1" } } }} /> <Token _id="TOKEN1" /></IndexPage>) Copy
import { IndexPage, Token, RegisterTokenIds } from "@xarc/jsx-renderer"export const Template = () => (<IndexPage> <RegisterTokenIds name="handler1" handler={setupContext => { return { TOKEN1: context => { return "result from TOKEN1" } } }} /> <Token _id="TOKEN1" /></IndexPage>)
JSX tag props
rendering context
Load and register classic template token handler for the JSX template. After loading the handler, its tokens can be used in the JSX template
Usage: (This is a JSX tag, don't call the function directly.)
<RegisterTokenIds name="handler1" handler={() => {...}}<RegisterTokenIds handler="./token-handlers" />"."then it will be resolved to the full path relative to the template's location, else it's a module for require.name, but you can provide a name prop if desired.Example: