UseResponsiveProps
Last updated: 2.0.0 (22/01/2024)
Last updated
Was this helpful?
Last updated: 2.0.0 (22/01/2024)
Last updated
Was this helpful?
useResponsiveProps
is a hook that returns the current props based on the current device breakpoint. This should be used before de-structuring responsive props in a component, and will automatically convert them to their mother type.
This hook is used internally in nearly every component, and forms the backbone of the system introduced in Valence 2.
While de-structuring, it may be advantageous to provide responsive defaults for a prop. To achieve this, use nested useResponsiveProps
hooks, like so: