Skip to content

useFloor

Category
Export Size
69 B
Package
@reause/math
Last Changed
5 days ago

Reactive Math.floor

Demo

Usage

tsx
import { 
useFloor
} from '@reause/math'
const
result
=
useFloor
(45.95) // 45

value is a plain read-only number. Re-render with a new value — e.g. from useState — and the hook recomputes:

tsx
import { 
useFloor
} from '@reause/math'
import {
useState
} from 'react'
const [
value
,
setValue
] =
useState
(45.95)
const
result
=
useFloor
(
value
) // 45
setValue
(-45.05) // triggers a re-render

Type Declarations

ts
export function useFloor(value: number): number

Source

Source · Demo · VueUse

Contributors

hairyf

Changelog

v0.1.0 on
f78e8 - fix(math): resolve useFloor audit findings (#786)
72edc - feat(math): add useFloor (#132)

Released under the MIT License. v0.1.8