Skip to content

useToString

Category
Export Size
76 B
Last Changed
5 days ago

Convert a value to its string representation.

value is a plain read-only value — pass the state value (or ref.current) directly. Unlike upstream, getters and refs are not unwrapped; the value is coerced as-is on every call.

Demo

Usage

tsx
import { 
useToString
} from '@reause/shared'
useToString
(123.345) // '123.345'
useToString
('hi') // 'hi'
useToString
({
foo
: 'hi' }) // '[object Object]'

Type Declarations

ts
export function useToString(value: unknown): string

Source

Source · Demo

Contributors

hairyf

Changelog

v0.1.0 on
47ae9 - fix(shared): resolve useToString audit findings (#758)
8fddc - chore!: remove all Vue-only Maybe* types and getter unions, adopt React Ref (#462)

Released under the MIT License. v0.1.8