How do vector based drawing apps generally work?

I tried to make my own kind of vector based drawing app with javascript and canvas, but calculating and rendering even a few lines seems to be unbelievably laggy, especially when panning or zooming (I’m currently just re-rendering every line when panning or zooming).

I’m wondering now if it is just the browser not being suited for that or if apps like Inkscape or even Goodnotes, instead of re-rendering the lines every time, just use a different kind of approach. Google has a kind of okay-ish app called “Google canvas” which runs on browser, but even compared to apps on desktop (like Inkscape) it seems terribly slow when drawing a lot of lines. 

Even when not working on browser, re-rendering every line after actions like panning, zooming, undoing etc. seems to me like a terrible idea, considering that apps like Inkscape run smoothly without a single lag even after hundreds of lines drawn, so if there is a different approach, which I am pretty sure there is, how does it work?