SolidJS utility that manages the presence of an element in the DOM while being aware of pending animations.
npm install solid-presenceSolidJS utility that manages the presence of an element in the DOM while being aware of pending animations.
The utility returns a boolean called present which indicates if the element should be present in the DOM or not.
The state variable can be used to get the current state of the presence. Valid states are present, hiding or hidden.
``tsx`
import createPresence from 'solid-presence'
`tsx
const DialogContent: Component<{
open?: boolean
}> = (props) => {
const [dialogRef, setDialogRef] = createSignal
const { present } = createPresence({
show: () => props.open,
element: dialogRef,
})
return (
Dialog
)
}
``