How to create widget both on python and js side?

Hi, I want to have for example a React widget that is both in python and js side and can be modified from both side.
I also want to be able to run commands from python side that are declared in js side and added to app.commands.

Could you please tell me if there is a sample for it or tutorial on how to create an extension that has both side (py & js). Thanks

Please see: