SolidJS utility to create persistent components that keep their state and elements cached when removed from the DOM.
## Features
- Persists both JavaScript state and HTML elements
- Supports SSR
## Usage
Import the `createPersistent` utility and pass your component to it. Make sure to call the utility inside a component that doesn't unmount. Then use the returned Accessor in your JSX where it can unmount.
```tsx
import createPersistent from 'solid-persistent'
```
```tsx
const PersistedDialogContent = () => {
const persistedContent = createPersistent(() => {
return
})
return (
)
}
```
## Further Reading
This utility is from the maintainers of [corvu](https://corvu.dev), a collection of unstyled, accessible and customizable UI primitives for SolidJS. It is also documented in the corvu docs under [Persistent](https://corvu.dev/docs/utilities/persistent).