0.0.2 • Published 1 year ago

@vyke/solid-destructurable v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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

0.0.2

1 year ago