79204372

Date: 2024-11-19 17:00:05
Score: 1
Natty:
Report link

This library https://github.com/asmyshlyaev177/state-in-url .

const form: Form = {
  someField: '',
  showDetails: false,
};

type Form = {
  someField: string;
  showDetails: boolean;
}

export const MyComponent = () => {
  const { urlState, setUrl } = useUrlState(form)
...
  urlState.showDetails // false
  setUrl({ showDetails: true })
  urlState.showDetails // true
}
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Aleksandr Smyshliaev