splitProps default value

how can i define the default value of a prop with split prop, for example the "loader" prop is optional i want tha make it true by default, but it is undefined
const [ local, rest ] = splitProps(props, ['loader'])
const [ local, rest ] = splitProps(props, ['loader'])
yes i can use a ternary and validate the value but i want to set the default value if it is possible
local.loader ? true : false
local.loader ? true : false
1 Reply
REEEEE
REEEEE8mo ago
use mergeProps
props = mergeProps(props, {loader: false})
const [ local, rest ] = splitProps(props, ['loader'])
props = mergeProps(props, {loader: false})
const [ local, rest ] = splitProps(props, ['loader'])