Skip to main content
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
82%
Published
4 months ago (0.0.2)

@vyke/solid-destructurable

Helper to destructure reactive objects - like props or stores - or signals of them into a separate accessors updated individually.

Installation

npm i @vyke/solid-destructurable

API

destructurable

Returns a destructurable object

import { createStore } from 'solid-js'
import { destructurable } from '@vyke/solid-destructurable'

type StoreState = {
	theme?: 'light' | 'dark'
}

type AppProps = {
	title: string
}

function App(props: AppProps) {
	const { title } = destructurable(props)
	const store = createStore<StoreState>({ theme: 'light' })
	const { theme } = destructurable(store, { theme: 'dark' })

	return (
		<div>
			{title()}
			{theme()}
		</div>
	)
}

Others vyke projects

Add Package

deno add jsr:@vyke/solid-destructurable

Import symbol

import * as mod from "@vyke/solid-destructurable";

---- OR ----

Import directly with a jsr specifier

import * as mod from "jsr:@vyke/solid-destructurable";

Add Package

npx jsr add @vyke/solid-destructurable

Import symbol

import * as mod from "@vyke/solid-destructurable";

Add Package

yarn dlx jsr add @vyke/solid-destructurable

Import symbol

import * as mod from "@vyke/solid-destructurable";

Add Package

pnpm dlx jsr add @vyke/solid-destructurable

Import symbol

import * as mod from "@vyke/solid-destructurable";

Add Package

bunx jsr add @vyke/solid-destructurable

Import symbol

import * as mod from "@vyke/solid-destructurable";