Instead of rendering huge amount of lines on the X and Y axis, we can simply make use of the SVG "pattern" feature :)
I found the original code here, but it was mixed in Vue syntax. This gist simply contains the 'raw' example of the grid related stuff :)
This can happen when the grid size grows larger then the SVG itself (in this example if the grid exceeds a width of 640 or a height of 480 pixel). You'll simply have to extend the SVG to a certain size and maybe hide it (in case your application has limited space) via style="overflow:hidden"
.