Skip to content

2.1 Update multiple params

Compare
Choose a tag to compare
@nandorojo nandorojo released this 11 Dec 20:14
· 244 commits to master since this release

In 2.1, createParam now exports a useUpdateParams hook, which lets you update multiple params in one function call:

import { createParam } from 'solito'

const { useUpdateParams } = createParam<{ direction: string, order: string }>()

export default function Page() {
  const update = useUpdateParams()

  const onPress = () => {
    update({ direction: 'asc', order: 'color' })
  }
}