{
  "id": "65095f934b14e8970cabf19c",
  "source": "solid:signals",
  "type": "github-document",
  "title": "from",
  "content": "---\ntitle: from\nuse_cases: \u003e-\n  rxjs interop, svelte stores integration, external observables, third-party\n  state management, converting subscriptions to signals\ntags:\n  - interop\n  - rxjs\n  - observables\n  - signals\n  - integration\nversion: '1.0'\ndescription: \u003e-\n  Convert RxJS observables and external producers into SolidJS signals. Seamless\n  integration with third-party reactive libraries and state managers.\n---\n\n```tsx\nimport { from } from \"solid-js\"\n\nfunction from\u003cT\u003e(\n\tproducer:\n\t\t| ((setter: (v: T) =\u003e T) =\u003e () =\u003e void)\n\t\t| {\n\t\t\t\tsubscribe: (\n\t\t\t\t\tfn: (v: T) =\u003e void\n\t\t\t\t) =\u003e (() =\u003e void) | { unsubscribe: () =\u003e void }\n\t\t  }\n): () =\u003e T | undefined\n\n```\n\nA helper to make it easier to interop with external producers like RxJS observables or with Svelte Stores.\nThis basically turns any subscribable (object with a subscribe method) into a Signal and manages subscription and disposal.\n\n```tsx\nconst signal = from(obsv$)\n```\n\nIt can also take a custom producer function where the function is passed a setter function that returns an unsubscribe function:\n\n```tsx\nconst clock = from((set) =\u003e {\n\tconst interval = setInterval(() =\u003e {\n\t\tset((v) =\u003e v + 1)\n\t}, 1000)\n\n\treturn () =\u003e clearInterval(interval)\n})\n```\n\n## Arguments\n\n| Name     | Type                                                                                                                           | Description                                  |\n| :------- | :----------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- |\n| producer | `((setter: (v: T) =\u003e T) =\u003e () =\u003e void) \\| { subscribe: (fn: (v: T) =\u003e void) =\u003e (() =\u003e void) \\| { unsubscribe: () =\u003e void }; }` | The producer function or subscribable object |",
  "url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/reference/reactive-utilities/from.mdx",
  "metadata": {
    "path": "src/routes/reference/reactive-utilities/from.mdx",
    "repo": "solidjs/solid-docs",
    "repo_url": "https://github.com/solidjs/solid-docs.git",
    "size": 1801,
    "source_type": "github"
  },
  "hash": "f3e5721a66c081b0e0353309b400e69db74ed081152e1d89bbf070b3980a0dd7",
  "timestamp": "2026-02-23T11:43:00.18989216+01:00"
}