{
  "id": "a5769ef189dead0675fda33d",
  "source": "solid:signals",
  "type": "github-document",
  "title": "once",
  "content": "---\ntitle: '@once'\norder: 5\nuse_cases: \u003e-\n  performance optimization, static props, non-reactive values, compile-time\n  optimization, reducing overhead\ntags:\n  - optimization\n  - performance\n  - static\n  - compiler\n  - jsx\nversion: '1.0'\ndescription: \u003e-\n  Optimize SolidJS components with @once decorator for static values. Prevent\n  unnecessary reactive wrapping and improve runtime performance.\n---\n\nSolid's compiler uses a heuristic for reactive wrapping and lazy evaluation of JSX expressions. Does it contain a function call, a property access, or JSX? If yes we wrap it in a getter when passed to components or in an effect if passed to native elements.\n\nKnowing this heuristic and its limitations, we can reduce overhead of things we know will never change by accessing them outside of the JSX. A lone variable will never be wrapped. We can also tell the compiler not to wrap them by starting the expression with a comment decorator `/* @once */`.\n\n```tsx\n\u003cMyComponent static={/*@once*/ state.wontUpdate} /\u003e\n```\n\nThis also works on children.\n\n```tsx\n\u003cMyComponent\u003e{/*@once*/ state.wontUpdate}\u003c/MyComponent\u003e\n```",
  "url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/reference/jsx-attributes/once.mdx",
  "metadata": {
    "path": "src/routes/reference/jsx-attributes/once.mdx",
    "repo": "solidjs/solid-docs",
    "repo_url": "https://github.com/solidjs/solid-docs.git",
    "size": 1117,
    "source_type": "github"
  },
  "hash": "0082b91f6c0788546a2f6aa9e7cbf80a03e485e12d57b721c43758dcee6b006b",
  "timestamp": "2026-02-23T11:43:00.189500354+01:00"
}