Hequalizer is framework-agnostic — it has no dependencies and interacts only with the DOM andDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/soyleninjs/hequalizer/llms.txt
Use this file to discover all available pages before exploring further.
window. Any framework that renders HTML elements can use it. The only requirement is that the target elements exist in the DOM before you create an instance, and that you call destroy() when those elements are removed to prevent memory leaks and stale resize listeners.
- React
- Vue 3
- Vanilla JS
React’s virtual DOM means elements are not available until after the component mounts. Create the Hequalizer instance inside a The empty dependency array
useEffect hook so it always runs after the initial render, and return destroy() as the cleanup function so React tears down the instance when the component unmounts.Load Hequalizer before your React app
Hequalizer ships as a plain script that sets
window.Hequalizer. Add it to your HTML before your bundle, or import the file directly in your entry point:index.html
Create and destroy the instance in useEffect
ProductGrid.jsx
[] ensures the effect runs once on mount. The cleanup function returned from useEffect calls destroy(), which removes the resize listener, disconnects MutationObserver instances, and removes the instance from Hequalizer’s internal registry — freeing the handle for reuse.Refresh elements when the item list changes
If your component renders a dynamic list of items, call
refreshElements() inside a second effect that depends on your items array:ProductGrid.jsx
refreshElements() re-queries the DOM for [data-hequalizer="product-title"], picks up any newly rendered elements, and recalculates heights.Keep the Hequalizer instance in a
useRef rather than useState. Storing it in state would trigger a re-render when the instance is assigned, which is unnecessary — the instance is a side-effect object, not UI state.When using Hequalizer with a SPA router (React Router, Vue Router, etc.), call
destroy() when navigating away from any view that contains equalized elements, then create a new instance when that view mounts again. Failing to destroy leaves an orphaned resize listener and a registered handle that will cause the constructor to throw a “handle already in use” error the next time the view mounts.