npm i @vyke/solid-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>
)
}