is ti better to use javascript, checking the window.innerwidth.
or is it better to have the display:none on media query
in terms of both lack of bugs and performance speed for simple situations.
for example:
you could either make a hook, or function that looks at the screen as ti changes or you could have a media query setting one to block and one to display none.
which one is faster and which one is less buggy?
In the case of check screen size and manipulate the style it's better using only CSS.
If you want to check the window width in JS you have to use something like a resize event attached to the window/document. And even if you wrap it in a debounce function it cost expensive calculations.
Also, there's the possibility that a user can have JavaScript disabled and your code didn't work at all.
If for some reasons (edit the content or functionality) you have to use JavaScript the better way is to use window.matchMedia() instead of the innerWidth function inside a resize event
Here more about it: https://webdevetc.com/blog/matchmedia-events-for-window-resizes/#windowmatchmedia-to-the-rescue