Skip to content

Serialize object to it's ID, and deserialize it back to an object #711

Answered by Pirulax
Pirulax asked this question in Q&A
Discussion options

You must be logged in to vote

Well I guess I could do a little wrapper too, and that would solve my issue pretty much:

export function useUserQueryState(name: string) {
  const [id, setId] = useQueryState(name);
  return [useGetUser(id), (user: User) => setId(user.id)];
}

I did have this solution in mind, but I just tunnel visioned on using the parser...
But this should be quite sufficient too.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@Pirulax
Comment options

@franky47
Comment options

@Pirulax
Comment options

Answer selected by franky47
@franky47
Comment options

@Pirulax
Comment options

@Pirulax
Comment options

@franky47
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants