Persistent
Utility to create persistent components that keep their state and elements cached when removed from the DOM.
Features Section titled Features
- Persists both JavaScript state and HTML elements
- Supports SSR
Installation Section titled Installation
npm install solid-persistent
Usage Section titled Usage
import createPersistent from 'solid-persistent'
const PersistedDialogContent = () => {
const persistedContent = createPersistent(() => {
return <input />
})
return (
<Dialog>
<Dialog.Trigger>
Open
</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Content>
{persistedContent()}
</Dialog.Content>
</Dialog.Portal>
</Dialog>
)
}
API reference Section titled API reference
Props
Property | Default | Type/Description |
---|---|---|
component | - | () => JSX.Element |
Returns
Property | Type/Description |
---|---|
persistedComponent | Accessor<JSX.Element> |
Developed and designed by Jasmin