Use useSelect/useDispatch instead of withSelect/withDispatch

I’ve built a Featured Gallery component for Gutenberg that uses the withSelect and withDispatch higher order components to store the selected images in a meta field.
I’m wondering if this code can be converted to use the useSelect and useDispatch hooks instead to simplify it. Is it possible? I tried to do it myself reading the almost useless Gutenberg docs with no success.
Any help would be appreciated.

Gutenberg: Block SelectControl saves attributes but after a reload of Gutenberg it loads its defaults. Why?

I thought I had it. I added an attribute “max_level” and a SelectControl element “SelectMaxLevel”. Everything works according to plan: I can set the max level and it is saved in the block. When I save the post and display the post see that the php part uses the “maximum level” variable. But when I edit the post the blocks loads it’s default value. Why does this happen?

Gutenberg: How to use block attributes with ServerSideRenderer?

I build a small TOC plugin with a ServerSideRender component. It’s an open-source hobby project to understand Gutenberg better: https://wordpress.org/plugins/simpletoc/ Now I would like to add attributes to the block to toggle options like “disable title”. A few months ago with your help here I managed to make the plugin work, but it sends “fake attributes”. In my case, this is only a date.