Frameworks like React and Vue allow me to define the UI as a function of state in a declarative way. The language happens to be JS. Please tell me how this can be done in vanilla JS without writing my own framework. I don't think it's possible. In my opinion they are not comparable, they both serve different goals.